markdown-text-editor 1.9.1 → 1.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -100,107 +100,107 @@ var o = ((e = "") => {
100
100
  hrRegex: i((e) => RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),
101
101
  fencesBeginRegex: i((e) => RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),
102
102
  headingBeginRegex: i((e) => RegExp(`^ {0,${e}}#`)),
103
- htmlBeginRegex: i((e) => RegExp(`^ {0,${e}}(?:</?(?:${y})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`, "i")),
103
+ htmlBeginRegex: i((e) => RegExp(`^ {0,${e}}(?:</?(?:${_})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`, "i")),
104
104
  blockquoteBeginRegex: i((e) => RegExp(`^ {0,${e}}>`))
105
- }, c = /^(?:[ \t]*(?:\n|$))+/, l = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, u = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, d = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, f = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, p = / {0,3}(?:[*+-]|\d{1,9}[.)])/, m = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, h = a(m).replace(/bull/g, p).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), g = a(m).replace(/bull/g, p).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), _ = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, v = /^[^\n]+/, ee = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, te = a(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", ee).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), ne = a(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, p).getRegex(), y = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", b = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, re = a("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", b).replace("tag", y).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), x = (e) => a(_).replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", e).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", y).getRegex(), ie = x(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), ae = x(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), oe = {
106
- blockquote: a(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ae).getRegex(),
105
+ }, c = /^(?:[ \t]*(?:\n|$))+/, l = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, u = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, d = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, f = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, p = / {0,3}(?:[*+-]|\d{1,9}[.)])/, m = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ee = a(m).replace(/bull/g, p).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), te = a(m).replace(/bull/g, p).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), h = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, g = /^[^\n]+/, ne = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, re = a(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", ne).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), ie = a(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, p).getRegex(), _ = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", v = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ae = a("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", v).replace("tag", _).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), oe = (e) => a(h).replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", e).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _).getRegex(), se = oe(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), y = oe(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), b = {
106
+ blockquote: a(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", y).getRegex(),
107
107
  code: l,
108
- def: te,
108
+ def: re,
109
109
  fences: u,
110
110
  heading: f,
111
111
  hr: d,
112
- html: re,
113
- lheading: h,
114
- list: ne,
112
+ html: ae,
113
+ lheading: ee,
114
+ list: ie,
115
115
  newline: c,
116
- paragraph: ie,
116
+ paragraph: se,
117
117
  table: r,
118
- text: v
119
- }, se = a("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", y).getRegex(), ce = {
120
- ...oe,
121
- lheading: g,
122
- table: se,
123
- paragraph: a(_).replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", y).getRegex()
124
- }, le = {
125
- ...oe,
126
- html: a("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", b).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
118
+ text: g
119
+ }, ce = a("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _).getRegex(), le = {
120
+ ...b,
121
+ lheading: te,
122
+ table: ce,
123
+ paragraph: a(h).replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ce).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _).getRegex()
124
+ }, ue = {
125
+ ...b,
126
+ html: a("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", v).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
127
127
  def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
128
128
  heading: /^(#{1,6})(.*)(?:\n+|$)/,
129
129
  fences: r,
130
130
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
131
- paragraph: a(_).replace("hr", d).replace("heading", " *#{1,6} *[^\n]").replace("lheading", h).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
132
- }, ue = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, de = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, fe = /^( {2,}|\\)\n(?!\s*$)[ \t]*/, pe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, S = /[\p{P}\p{S}]/u, me = /[\s\p{P}\p{S}]/u, he = /[^\s\p{P}\p{S}]/u, ge = a(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, me).getRegex(), C = /[\p{Pi}\p{Ps}"']/u, _e = /(?!~)[\p{P}\p{S}]/u, ve = /(?!~)[\s\p{P}\p{S}]/u, ye = /(?:[^\s\p{P}\p{S}]|~)/u, be = a(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", o ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), xe = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Se = a(xe, "u").replace(/punct/g, S).getRegex(), Ce = a(xe, "u").replace(/punct/g, _e).getRegex(), we = a(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, C).replace(/punct/g, S).getRegex(), Te = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", w = a(Te, "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), Ee = a(Te, "gu").replace(/notPunctSpace/g, ye).replace(/punctSpace/g, ve).replace(/punct/g, _e).getRegex(), T = a("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), De = a("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), E = a("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), Oe = a(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, S).getRegex(), ke = a("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), D = a(/\\(punct)/, "gu").replace(/punct/g, S).getRegex(), Ae = a(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), je = a(b).replace("(?:-->|$)", "-->").getRegex(), Me = a("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ne = /\[(?:\\[\s\S]|[^\[\]\\])*\]/, O = a(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", Ne).getRegex(), Pe = a(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", O).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Fe = a(/^!?\[(label)\]\[(ref)\]/).replace("label", O).replace("ref", ee).getRegex(), Ie = a(/^!?\[(ref)\](?:\[\])?/).replace("ref", ee).getRegex(), Le = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/, Re = a(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", Ne).getRegex(), ze = a("reflink|nolink(?!\\()", "g").replace("reflink", a(/^!?\[(label)\]\[(ref)\]/).replace("label", Re).replace("ref", Le).getRegex()).replace("nolink", a(/^!?\[(ref)\](?:\[\])?/).replace("ref", Le).getRegex()).getRegex(), Be = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Ve = a(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(), He = {
131
+ paragraph: a(h).replace("hr", d).replace("heading", " *#{1,6} *[^\n]").replace("lheading", ee).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
132
+ }, de = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, fe = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, pe = /^( {2,}|\\)\n(?!\s*$)[ \t]*/, me = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, x = /[\p{P}\p{S}]/u, S = /[\s\p{P}\p{S}]/u, he = /[^\s\p{P}\p{S}]/u, ge = a(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, S).getRegex(), _e = /[\p{Pi}\p{Ps}"']/u, ve = /(?!~)[\p{P}\p{S}]/u, C = /(?!~)[\s\p{P}\p{S}]/u, ye = /(?:[^\s\p{P}\p{S}]|~)/u, be = a(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", o ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), xe = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Se = a(xe, "u").replace(/punct/g, x).getRegex(), Ce = a(xe, "u").replace(/punct/g, ve).getRegex(), we = a(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, _e).replace(/punct/g, x).getRegex(), Te = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ee = a(Te, "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, S).replace(/punct/g, x).getRegex(), De = a(Te, "gu").replace(/notPunctSpace/g, ye).replace(/punctSpace/g, C).replace(/punct/g, ve).getRegex(), w = a("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, S).replace(/punct/g, x).getRegex(), Oe = a("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, S).replace(/punct/g, x).getRegex(), T = a("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, S).replace(/punct/g, x).getRegex(), ke = a(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, x).getRegex(), E = a("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, S).replace(/punct/g, x).getRegex(), Ae = a(/\\(punct)/, "gu").replace(/punct/g, x).getRegex(), je = a(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), D = a(v).replace("(?:-->|$)", "-->").getRegex(), Me = a("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", D).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ne = /\[(?:\\[\s\S]|[^\[\]\\])*\]/, Pe = a(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", Ne).getRegex(), Fe = a(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", Pe).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), O = a(/^!?\[(label)\]\[(ref)\]/).replace("label", Pe).replace("ref", ne).getRegex(), Ie = a(/^!?\[(ref)\](?:\[\])?/).replace("ref", ne).getRegex(), k = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/, Le = a(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", Ne).getRegex(), Re = a("reflink|nolink(?!\\()", "g").replace("reflink", a(/^!?\[(label)\]\[(ref)\]/).replace("label", Le).replace("ref", k).getRegex()).replace("nolink", a(/^!?\[(ref)\](?:\[\])?/).replace("ref", k).getRegex()).getRegex(), ze = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Be = a(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(), A = {
133
133
  _backpedal: r,
134
- anyPunctuation: D,
135
- autolink: Ae,
134
+ anyPunctuation: Ae,
135
+ autolink: je,
136
136
  blockSkip: be,
137
- br: fe,
138
- code: de,
137
+ br: pe,
138
+ code: fe,
139
139
  del: r,
140
140
  delLDelim: r,
141
141
  delRDelim: r,
142
142
  emStrongLDelim: Se,
143
- emStrongRDelimAst: w,
144
- emStrongRDelimUnd: De,
145
- escape: ue,
146
- link: Pe,
143
+ emStrongRDelimAst: Ee,
144
+ emStrongRDelimUnd: Oe,
145
+ escape: de,
146
+ link: Fe,
147
147
  nolink: Ie,
148
148
  punctuation: ge,
149
- reflink: Fe,
150
- reflinkSearch: ze,
149
+ reflink: O,
150
+ reflinkSearch: Re,
151
151
  tag: Me,
152
- text: pe,
152
+ text: me,
153
153
  url: r
154
- }, Ue = {
155
- ...He,
154
+ }, Ve = {
155
+ ...A,
156
156
  emStrongLDelim: we,
157
- emStrongRDelimAst: T,
158
- emStrongRDelimUnd: E,
159
- link: a(/^!?\[(label)\]\((.*?)\)/).replace("label", O).getRegex(),
160
- reflink: a(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", O).getRegex()
161
- }, We = {
162
- ...He,
163
- emStrongRDelimAst: Ee,
157
+ emStrongRDelimAst: w,
158
+ emStrongRDelimUnd: T,
159
+ link: a(/^!?\[(label)\]\((.*?)\)/).replace("label", Pe).getRegex(),
160
+ reflink: a(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Pe).getRegex()
161
+ }, He = {
162
+ ...A,
163
+ emStrongRDelimAst: De,
164
164
  emStrongLDelim: Ce,
165
- delLDelim: Oe,
166
- delRDelim: ke,
167
- url: a(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", Ve).replace("protocol", Be).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),
165
+ delLDelim: ke,
166
+ delRDelim: E,
167
+ url: a(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", Be).replace("protocol", ze).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),
168
168
  _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
169
169
  del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
170
- text: a(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", Be).replace(/emailProtocol/g, /(?:mailto|xmpp):/).getRegex()
170
+ text: a(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", ze).replace(/emailProtocol/g, /(?:mailto|xmpp):/).getRegex()
171
+ }, Ue = {
172
+ ...He,
173
+ br: a(pe).replace("{2,}", "*").getRegex(),
174
+ text: a(He.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
175
+ }, We = {
176
+ normal: b,
177
+ gfm: le,
178
+ pedantic: ue
171
179
  }, Ge = {
172
- ...We,
173
- br: a(fe).replace("{2,}", "*").getRegex(),
174
- text: a(We.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
180
+ normal: A,
181
+ gfm: He,
182
+ breaks: Ue,
183
+ pedantic: Ve
175
184
  }, Ke = {
176
- normal: oe,
177
- gfm: ce,
178
- pedantic: le
179
- }, qe = {
180
- normal: He,
181
- gfm: We,
182
- breaks: Ge,
183
- pedantic: Ue
184
- }, Je = {
185
185
  "&": "&amp;",
186
186
  "<": "&lt;",
187
187
  ">": "&gt;",
188
188
  "\"": "&quot;",
189
189
  "'": "&#39;"
190
- }, Ye = (e) => Je[e];
191
- function k(e, t) {
190
+ }, qe = (e) => Ke[e];
191
+ function j(e, t) {
192
192
  if (t) {
193
- if (s.escapeTest.test(e)) return e.replace(s.escapeReplace, Ye);
194
- } else if (s.escapeTestNoEncode.test(e)) return e.replace(s.escapeReplaceNoEncode, Ye);
193
+ if (s.escapeTest.test(e)) return e.replace(s.escapeReplace, qe);
194
+ } else if (s.escapeTestNoEncode.test(e)) return e.replace(s.escapeReplaceNoEncode, qe);
195
195
  return e;
196
196
  }
197
- function Xe(e) {
197
+ function Je(e) {
198
198
  return e.replace(s.numericCharacterReference, (e, t, n) => {
199
199
  let r = t === void 0 ? Number.parseInt(n, 16) : Number.parseInt(t, 10);
200
200
  return r === 0 || r > 1114111 || r >= 55296 && r <= 57343 ? "�" : String.fromCodePoint(r);
201
201
  });
202
202
  }
203
- function Ze(e) {
203
+ function M(e) {
204
204
  try {
205
205
  e = encodeURI(e).replace(s.percentDecode, "%");
206
206
  } catch {
@@ -208,7 +208,7 @@ function Ze(e) {
208
208
  }
209
209
  return e;
210
210
  }
211
- function Qe(e, t) {
211
+ function Ye(e, t) {
212
212
  let n = e.replace(s.findPipe, (e, t, n) => {
213
213
  let r = !1, i = t;
214
214
  for (; --i >= 0 && n[i] === "\\";) r = !r;
@@ -221,7 +221,7 @@ function Qe(e, t) {
221
221
  for (; r < n.length; r++) n[r] = n[r].trim().replace(s.slashPipe, "|");
222
222
  return n;
223
223
  }
224
- function A(e, t, n) {
224
+ function N(e, t, n) {
225
225
  let r = e.length;
226
226
  if (r === 0) return "";
227
227
  let i = 0;
@@ -233,15 +233,15 @@ function A(e, t, n) {
233
233
  }
234
234
  return e.slice(0, r - i);
235
235
  }
236
- function $e(e) {
236
+ function Xe(e) {
237
237
  let t = e.split("\n"), n = t.length - 1;
238
238
  for (; n >= 0 && s.blankLine.test(t[n]);) n--;
239
239
  return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
240
240
  }
241
- function j(e) {
241
+ function Ze(e) {
242
242
  return e.trim().toLowerCase().toUpperCase().toLowerCase();
243
243
  }
244
- function M(e, t) {
244
+ function Qe(e, t) {
245
245
  if (e.indexOf(t[1]) === -1) return -1;
246
246
  let n = 0;
247
247
  for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
@@ -249,7 +249,7 @@ function M(e, t) {
249
249
  else if (e[r] === t[1] && (n--, n < 0)) return r;
250
250
  return n > 0 ? -2 : -1;
251
251
  }
252
- function N(e, t = 0) {
252
+ function $e(e, t = 0) {
253
253
  let n = t, r = "";
254
254
  for (let t of e) if (t === " ") {
255
255
  let e = 4 - n % 4;
@@ -279,7 +279,7 @@ function et(e, t, n, r, i) {
279
279
  tokens: d
280
280
  };
281
281
  }
282
- function tt(e, t, n) {
282
+ function P(e, t, n) {
283
283
  let r = e.match(n.other.indentCodeCompensation);
284
284
  if (r === null) return t;
285
285
  let i = r[1];
@@ -290,7 +290,7 @@ function tt(e, t, n) {
290
290
  return e.slice(Math.min(r.length, i.length));
291
291
  }).join("\n");
292
292
  }
293
- function nt(e, t, n, r) {
293
+ function tt(e, t, n, r) {
294
294
  if (!t.includes("<")) return !1;
295
295
  for (let i = 0; i < t.length; i++) {
296
296
  if (t[i] === "\\") {
@@ -313,7 +313,7 @@ function nt(e, t, n, r) {
313
313
  }
314
314
  return !1;
315
315
  }
316
- var rt = class {
316
+ var nt = class {
317
317
  options;
318
318
  rules;
319
319
  lexer;
@@ -330,7 +330,7 @@ var rt = class {
330
330
  code(e) {
331
331
  let t = this.rules.block.code.exec(e);
332
332
  if (t) {
333
- let e = this.options.pedantic ? t[0] : $e(t[0]);
333
+ let e = this.options.pedantic ? t[0] : Xe(t[0]);
334
334
  return {
335
335
  type: "code",
336
336
  raw: e,
@@ -342,7 +342,7 @@ var rt = class {
342
342
  fences(e) {
343
343
  let t = this.rules.block.fences.exec(e);
344
344
  if (t) {
345
- let e = t[0], n = tt(e, t[3] || "", this.rules);
345
+ let e = t[0], n = P(e, t[3] || "", this.rules);
346
346
  return {
347
347
  type: "code",
348
348
  raw: e,
@@ -356,12 +356,12 @@ var rt = class {
356
356
  if (t) {
357
357
  let e = t[2].trim();
358
358
  if (this.rules.other.endingHash.test(e)) {
359
- let t = A(e, "#");
359
+ let t = N(e, "#");
360
360
  (this.options.pedantic || !t || this.rules.other.endingSpaceTabChar.test(t)) && (e = t.trim());
361
361
  }
362
362
  return {
363
363
  type: "heading",
364
- raw: A(t[0], "\n"),
364
+ raw: N(t[0], "\n"),
365
365
  depth: t[1].length,
366
366
  text: e,
367
367
  tokens: this.lexer.inline(e)
@@ -372,13 +372,13 @@ var rt = class {
372
372
  let t = this.rules.block.hr.exec(e);
373
373
  if (t) return {
374
374
  type: "hr",
375
- raw: A(t[0], "\n")
375
+ raw: N(t[0], "\n")
376
376
  };
377
377
  }
378
378
  blockquote(e) {
379
379
  let t = this.rules.block.blockquote.exec(e);
380
380
  if (t) {
381
- let e = A(t[0], "\n").split("\n"), n = "", r = "", i = [];
381
+ let e = N(t[0], "\n").split("\n"), n = "", r = "", i = [];
382
382
  for (; e.length > 0;) {
383
383
  let t = !1, a = [], o = 0;
384
384
  for (; o < e.length; o++) if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
@@ -432,7 +432,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
432
432
  let n = !1, r = "", s = "";
433
433
  if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
434
434
  r = t[0], e = e.substring(r.length);
435
- let c = t[2].split("\n", 1)[0], l = t[1].length, u = this.options.pedantic ? N(c, l) : c.replace(this.rules.other.leadingSpaceTab, (e) => N(e, l)), d = e.split("\n", 1)[0], f = !u.trim(), p = 0;
435
+ let c = t[2].split("\n", 1)[0], l = t[1].length, u = this.options.pedantic ? $e(c, l) : c.replace(this.rules.other.leadingSpaceTab, (e) => $e(e, l)), d = e.split("\n", 1)[0], f = !u.trim(), p = 0;
436
436
  if (this.options.pedantic ? (p = 2, s = u.trimStart()) : f ? p = l + 1 : (p = u.search(this.rules.other.nonSpaceChar), p = p > 4 ? 1 : p, s = u.slice(p), p += l), f && this.rules.other.blankLine.test(d) && (r += d + "\n", e = e.substring(d.length + 1), n = !0), !n) {
437
437
  let t = this.rules.other.nextBulletRegex(p), n = this.rules.other.hrRegex(p), i = this.rules.other.fencesBeginRegex(p), a = this.rules.other.headingBeginRegex(p), o = this.rules.other.htmlBeginRegex(p), c = this.rules.other.blockquoteBeginRegex(p);
438
438
  for (; e;) {
@@ -497,7 +497,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
497
497
  html(e) {
498
498
  let t = this.rules.block.html.exec(e);
499
499
  if (t) {
500
- let e = $e(t[0]);
500
+ let e = Xe(t[0]);
501
501
  return {
502
502
  type: "html",
503
503
  block: !0,
@@ -510,11 +510,11 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
510
510
  def(e) {
511
511
  let t = this.rules.block.def.exec(e);
512
512
  if (t) {
513
- let e = j(t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
513
+ let e = Ze(t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
514
514
  return {
515
515
  type: "def",
516
516
  tag: e,
517
- raw: A(t[0], "\n"),
517
+ raw: N(t[0], "\n"),
518
518
  href: n,
519
519
  title: r
520
520
  };
@@ -523,9 +523,9 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
523
523
  table(e) {
524
524
  let t = this.rules.block.table.exec(e);
525
525
  if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
526
- let n = Qe(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
526
+ let n = Ye(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
527
527
  type: "table",
528
- raw: A(t[0], "\n"),
528
+ raw: N(t[0], "\n"),
529
529
  header: [],
530
530
  align: [],
531
531
  rows: []
@@ -538,7 +538,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
538
538
  header: !0,
539
539
  align: a.align[e]
540
540
  });
541
- for (let e of i) a.rows.push(Qe(e, a.header.length).map((e, t) => ({
541
+ for (let e of i) a.rows.push(Ye(e, a.header.length).map((e, t) => ({
542
542
  text: e,
543
543
  tokens: this.lexer.inline(e),
544
544
  header: !1,
@@ -553,7 +553,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
553
553
  let e = t[1].trim();
554
554
  return {
555
555
  type: "heading",
556
- raw: A(t[0], "\n"),
556
+ raw: N(t[0], "\n"),
557
557
  depth: t[2].charAt(0) === "=" ? 1 : 2,
558
558
  text: e,
559
559
  tokens: this.lexer.inline(e)
@@ -604,14 +604,14 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
604
604
  let t = this.rules.inline.link.exec(e);
605
605
  if (t) {
606
606
  let n = t[0].charAt(0) === "!" ? 2 : 1;
607
- if (!this.options.pedantic && nt(e, t[1], n, this.rules)) return;
607
+ if (!this.options.pedantic && tt(e, t[1], n, this.rules)) return;
608
608
  let r = t[2].trim();
609
609
  if (!this.options.pedantic && this.rules.other.startAngleBracket.test(r)) {
610
610
  if (!this.rules.other.endAngleBracket.test(r)) return;
611
- let e = A(r.slice(0, -1), "\\");
611
+ let e = N(r.slice(0, -1), "\\");
612
612
  if ((r.length - e.length) % 2 == 0) return;
613
613
  } else {
614
- let e = M(t[2], "()");
614
+ let e = Qe(t[2], "()");
615
615
  if (e === -2) return;
616
616
  if (e > -1) {
617
617
  let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
@@ -633,8 +633,8 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
633
633
  let n;
634
634
  if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
635
635
  let r = n[0].charAt(0) === "!" ? 2 : 1;
636
- if (!this.options.pedantic && nt(e, n[1], r, this.rules)) return;
637
- let i = t[j((n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "))];
636
+ if (!this.options.pedantic && tt(e, n[1], r, this.rules)) return;
637
+ let i = t[Ze((n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "))];
638
638
  if (!i) {
639
639
  let e = n[0].charAt(0);
640
640
  return {
@@ -776,19 +776,19 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
776
776
  return {
777
777
  type: "text",
778
778
  raw: t[0],
779
- text: e ? t[0] : Xe(t[0]),
779
+ text: e ? t[0] : Je(t[0]),
780
780
  escaped: e
781
781
  };
782
782
  }
783
783
  }
784
- }, P = class e {
784
+ }, F = class e {
785
785
  tokens;
786
786
  options;
787
787
  state;
788
788
  inlineQueue;
789
789
  tokenizer;
790
790
  constructor(e) {
791
- this.tokens = [], this.tokens.links = Object.create(null), this.options = e || t, this.options.tokenizer = this.options.tokenizer || new rt(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
791
+ this.tokens = [], this.tokens.links = Object.create(null), this.options = e || t, this.options.tokenizer = this.options.tokenizer || new nt(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
792
792
  inLink: !1,
793
793
  inRawBlock: !1,
794
794
  linkEmitted: !1,
@@ -796,15 +796,15 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
796
796
  };
797
797
  let n = {
798
798
  other: s,
799
- block: Ke.normal,
800
- inline: qe.normal
799
+ block: We.normal,
800
+ inline: Ge.normal
801
801
  };
802
- this.options.pedantic ? (n.block = Ke.pedantic, n.inline = qe.pedantic) : this.options.gfm && (n.block = Ke.gfm, n.inline = this.options.breaks ? qe.breaks : qe.gfm), this.tokenizer.rules = n;
802
+ this.options.pedantic ? (n.block = We.pedantic, n.inline = Ge.pedantic) : this.options.gfm && (n.block = We.gfm, n.inline = this.options.breaks ? Ge.breaks : Ge.gfm), this.tokenizer.rules = n;
803
803
  }
804
804
  static get rules() {
805
805
  return {
806
- block: Ke,
807
- inline: qe
806
+ block: We,
807
+ inline: Ge
808
808
  };
809
809
  }
810
810
  static lex(t, n) {
@@ -922,7 +922,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
922
922
  for (let n of e.matchAll(this.tokenizer.rules.inline.blockSkip)) if (t.test(n[0]) && e.charAt(n.index - 1) !== "!") return !0;
923
923
  for (let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)) {
924
924
  let e = t[0], n = e.lastIndexOf("[");
925
- if (e.charAt(0) !== "!" && Object.hasOwn(this.tokens.links, j(e.slice(n + 1, -1))) && !(n > 1 && this.linkInText(e.slice(1, n - 1)))) return !0;
925
+ if (e.charAt(0) !== "!" && Object.hasOwn(this.tokens.links, Ze(e.slice(n + 1, -1))) && !(n > 1 && this.linkInText(e.slice(1, n - 1)))) return !0;
926
926
  }
927
927
  return !1;
928
928
  }
@@ -932,7 +932,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
932
932
  if (this.tokens.links && e.includes("[")) {
933
933
  let e = this.tokenizer.rules.inline.reflinkSearch, t = (n) => {
934
934
  let r = n.lastIndexOf("[");
935
- if (!Object.hasOwn(this.tokens.links, j(n.slice(r + 1, -1)))) return n;
935
+ if (!Object.hasOwn(this.tokens.links, Ze(n.slice(r + 1, -1)))) return n;
936
936
  if (r > 1 && n.charAt(0) !== "!") {
937
937
  let i = n.slice(1, r - 1);
938
938
  if (this.linkInText(i)) return "[" + i.replace(e, t) + "][" + "a".repeat(n.length - r - 2) + "]";
@@ -1022,7 +1022,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
1022
1022
  if (this.options.silent) console.error(t);
1023
1023
  else throw Error(t);
1024
1024
  }
1025
- }, it = class {
1025
+ }, rt = class {
1026
1026
  options;
1027
1027
  parser;
1028
1028
  constructor(e) {
@@ -1033,7 +1033,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
1033
1033
  }
1034
1034
  code({ text: e, lang: t, escaped: n }) {
1035
1035
  let r = (t || "").match(s.notSpaceStart)?.[0], i = e ? e.replace(s.endingNewline, "") + "\n" : "";
1036
- return r ? "<pre><code class=\"language-" + k(r) + "\">" + (n ? i : k(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : k(i, !0)) + "</code></pre>\n";
1036
+ return r ? "<pre><code class=\"language-" + j(r) + "\">" + (n ? i : j(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : j(i, !0)) + "</code></pre>\n";
1037
1037
  }
1038
1038
  blockquote({ tokens: e }) {
1039
1039
  return `<blockquote>
@@ -1103,7 +1103,7 @@ ${e}</tr>
1103
1103
  return `<em>${this.parser.parseInline(e)}</em>`;
1104
1104
  }
1105
1105
  codespan({ text: e }) {
1106
- return `<code>${k(e, !0)}</code>`;
1106
+ return `<code>${j(e, !0)}</code>`;
1107
1107
  }
1108
1108
  br(e) {
1109
1109
  return "<br>";
@@ -1112,24 +1112,24 @@ ${e}</tr>
1112
1112
  return `<del>${this.parser.parseInline(e)}</del>`;
1113
1113
  }
1114
1114
  link({ href: e, title: t, text: n, tokens: r, autolink: i }) {
1115
- let a = i ? k(n, !0) : this.parser.parseInline(r), o = Ze(e);
1115
+ let a = i ? j(n, !0) : this.parser.parseInline(r), o = M(e);
1116
1116
  if (o === null) return a;
1117
- e = k(o, i);
1117
+ e = j(o, i);
1118
1118
  let s = "<a href=\"" + e + "\"";
1119
- return t && (s += " title=\"" + k(t) + "\""), s += ">" + a + "</a>", s;
1119
+ return t && (s += " title=\"" + j(t) + "\""), s += ">" + a + "</a>", s;
1120
1120
  }
1121
1121
  image({ href: e, title: t, text: n, tokens: r }) {
1122
1122
  r && (n = this.parser.parseInline(r, this.parser.textRenderer));
1123
- let i = Ze(e);
1124
- if (i === null) return k(n);
1123
+ let i = M(e);
1124
+ if (i === null) return j(n);
1125
1125
  e = i;
1126
- let a = `<img src="${k(e)}" alt="${k(n)}"`;
1127
- return t && (a += ` title="${k(t)}"`), a += ">", a;
1126
+ let a = `<img src="${j(e)}" alt="${j(n)}"`;
1127
+ return t && (a += ` title="${j(t)}"`), a += ">", a;
1128
1128
  }
1129
1129
  text(e) {
1130
- return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : k(e.text);
1130
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : j(e.text);
1131
1131
  }
1132
- }, at = class {
1132
+ }, it = class {
1133
1133
  strong({ text: e }) {
1134
1134
  return e;
1135
1135
  }
@@ -1160,12 +1160,12 @@ ${e}</tr>
1160
1160
  checkbox({ raw: e }) {
1161
1161
  return e;
1162
1162
  }
1163
- }, F = class e {
1163
+ }, I = class e {
1164
1164
  options;
1165
1165
  renderer;
1166
1166
  textRenderer;
1167
1167
  constructor(e) {
1168
- this.options = e || t, this.options.renderer = this.options.renderer || new it(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new at();
1168
+ this.options = e || t, this.options.renderer = this.options.renderer || new rt(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new it();
1169
1169
  }
1170
1170
  static parse(t, n) {
1171
1171
  return new e(n).parse(t);
@@ -1313,7 +1313,7 @@ ${e}</tr>
1313
1313
  }
1314
1314
  return n;
1315
1315
  }
1316
- }, I = class {
1316
+ }, at = class {
1317
1317
  options;
1318
1318
  block;
1319
1319
  constructor(e) {
@@ -1343,22 +1343,22 @@ ${e}</tr>
1343
1343
  return e;
1344
1344
  }
1345
1345
  provideLexer(e = this.block) {
1346
- return e ? P.lex : P.lexInline;
1346
+ return e ? F.lex : F.lexInline;
1347
1347
  }
1348
1348
  provideParser(e = this.block) {
1349
- return e ? F.parse : F.parseInline;
1349
+ return e ? I.parse : I.parseInline;
1350
1350
  }
1351
1351
  }, ot = class {
1352
1352
  defaults = e();
1353
1353
  options = this.setOptions;
1354
1354
  parse = this.parseMarkdown(!0);
1355
1355
  parseInline = this.parseMarkdown(!1);
1356
- Parser = F;
1357
- Renderer = it;
1358
- TextRenderer = at;
1359
- Lexer = P;
1360
- Tokenizer = rt;
1361
- Hooks = I;
1356
+ Parser = I;
1357
+ Renderer = rt;
1358
+ TextRenderer = it;
1359
+ Lexer = F;
1360
+ Tokenizer = nt;
1361
+ Hooks = at;
1362
1362
  constructor(...e) {
1363
1363
  this.use(...e);
1364
1364
  }
@@ -1409,7 +1409,7 @@ ${e}</tr>
1409
1409
  }
1410
1410
  "childTokens" in e && e.childTokens && (t.childTokens[e.name] = e.childTokens);
1411
1411
  }), n.extensions = t), e.renderer) {
1412
- let t = this.defaults.renderer || new it(this.defaults);
1412
+ let t = this.defaults.renderer || new rt(this.defaults);
1413
1413
  for (let n in e.renderer) {
1414
1414
  if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
1415
1415
  if (["options", "parser"].includes(n)) continue;
@@ -1422,7 +1422,7 @@ ${e}</tr>
1422
1422
  n.renderer = t;
1423
1423
  }
1424
1424
  if (e.tokenizer) {
1425
- let t = this.defaults.tokenizer || new rt(this.defaults);
1425
+ let t = this.defaults.tokenizer || new nt(this.defaults);
1426
1426
  for (let n in e.tokenizer) {
1427
1427
  if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
1428
1428
  if ([
@@ -1439,13 +1439,13 @@ ${e}</tr>
1439
1439
  n.tokenizer = t;
1440
1440
  }
1441
1441
  if (e.hooks) {
1442
- let t = this.defaults.hooks || new I();
1442
+ let t = this.defaults.hooks || new at();
1443
1443
  for (let n in e.hooks) {
1444
1444
  if (!(n in t)) throw Error(`hook '${n}' does not exist`);
1445
1445
  if (["options", "block"].includes(n)) continue;
1446
1446
  let r = n, i = e.hooks[r], a = t[r];
1447
- t[r] = I.passThroughHooks.has(n) ? (e) => {
1448
- if (this.defaults.async && I.passThroughHooksRespectAsync.has(n)) return (async () => {
1447
+ t[r] = at.passThroughHooks.has(n) ? (e) => {
1448
+ if (this.defaults.async && at.passThroughHooksRespectAsync.has(n)) return (async () => {
1449
1449
  let n = await i.call(t, e);
1450
1450
  return a.call(t, n);
1451
1451
  })();
@@ -1482,10 +1482,10 @@ ${e}</tr>
1482
1482
  }, this;
1483
1483
  }
1484
1484
  lexer(e, t) {
1485
- return P.lex(e, t ?? this.defaults);
1485
+ return F.lex(e, t ?? this.defaults);
1486
1486
  }
1487
1487
  parser(e, t) {
1488
- return F.parse(e, t ?? this.defaults);
1488
+ return I.parse(e, t ?? this.defaults);
1489
1489
  }
1490
1490
  parseMarkdown(e) {
1491
1491
  return (t, n) => {
@@ -1497,16 +1497,16 @@ ${e}</tr>
1497
1497
  if (typeof t > "u" || t === null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
1498
1498
  if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
1499
1499
  if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
1500
- let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ? P.lex : P.lexInline)(n, i), a = i.hooks ? await i.hooks.processAllTokens(r) : r;
1500
+ let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ? F.lex : F.lexInline)(n, i), a = i.hooks ? await i.hooks.processAllTokens(r) : r;
1501
1501
  i.walkTokens && await Promise.all(this.walkTokens(a, i.walkTokens));
1502
- let o = await (i.hooks ? await i.hooks.provideParser(e) : e ? F.parse : F.parseInline)(a, i);
1502
+ let o = await (i.hooks ? await i.hooks.provideParser(e) : e ? I.parse : I.parseInline)(a, i);
1503
1503
  return i.hooks ? await i.hooks.postprocess(o) : o;
1504
1504
  })().catch(a);
1505
1505
  try {
1506
1506
  i.hooks && (t = i.hooks.preprocess(t));
1507
- let n = (i.hooks ? i.hooks.provideLexer(e) : e ? P.lex : P.lexInline)(t, i);
1507
+ let n = (i.hooks ? i.hooks.provideLexer(e) : e ? F.lex : F.lexInline)(t, i);
1508
1508
  i.hooks && (n = i.hooks.processAllTokens(n)), i.walkTokens && this.walkTokens(n, i.walkTokens);
1509
- let r = (i.hooks ? i.hooks.provideParser(e) : e ? F.parse : F.parseInline)(n, i);
1509
+ let r = (i.hooks ? i.hooks.provideParser(e) : e ? I.parse : I.parseInline)(n, i);
1510
1510
  return i.hooks && (r = i.hooks.postprocess(r)), r;
1511
1511
  } catch (e) {
1512
1512
  return a(e);
@@ -1516,29 +1516,29 @@ ${e}</tr>
1516
1516
  onError(e, t) {
1517
1517
  return (n) => {
1518
1518
  if (n.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
1519
- let e = "<p>An error occurred:</p><pre>" + k(n.message + "", !0) + "</pre>";
1519
+ let e = "<p>An error occurred:</p><pre>" + j(n.message + "", !0) + "</pre>";
1520
1520
  return t ? Promise.resolve(e) : e;
1521
1521
  }
1522
1522
  if (t) return Promise.reject(n);
1523
1523
  throw n;
1524
1524
  };
1525
1525
  }
1526
- }, L = new ot();
1527
- function R(e, t) {
1528
- return L.parse(e, t);
1526
+ }, st = new ot();
1527
+ function L(e, t) {
1528
+ return st.parse(e, t);
1529
1529
  }
1530
- R.options = R.setOptions = function(e) {
1531
- return L.setOptions(e), R.defaults = L.defaults, n(R.defaults), R;
1532
- }, R.getDefaults = e, R.defaults = t;
1533
- function st(...e) {
1534
- return L.use(...e), R.defaults = L.defaults, n(R.defaults), R;
1530
+ L.options = L.setOptions = function(e) {
1531
+ return st.setOptions(e), L.defaults = st.defaults, n(L.defaults), L;
1532
+ }, L.getDefaults = e, L.defaults = t;
1533
+ function ct(...e) {
1534
+ return st.use(...e), L.defaults = st.defaults, n(L.defaults), L;
1535
1535
  }
1536
- R.use = st, R.walkTokens = function(e, t) {
1537
- return L.walkTokens(e, t);
1538
- }, R.parseInline = L.parseInline, R.Parser = F, R.parser = F.parse, R.Renderer = it, R.TextRenderer = at, R.Lexer = P, R.lexer = P.lex, R.Tokenizer = rt, R.Hooks = I, R.parse = R, R.options, R.setOptions, R.walkTokens, R.parseInline, F.parse, P.lex;
1536
+ L.use = ct, L.walkTokens = function(e, t) {
1537
+ return st.walkTokens(e, t);
1538
+ }, L.parseInline = st.parseInline, L.Parser = I, L.parser = I.parse, L.Renderer = rt, L.TextRenderer = it, L.Lexer = F, L.lexer = F.lex, L.Tokenizer = nt, L.Hooks = at, L.parse = L, L.options, L.setOptions, L.walkTokens, L.parseInline, I.parse, F.lex;
1539
1539
  //#endregion
1540
1540
  //#region node_modules/dompurify/dist/purify.es.mjs
1541
- function ct(e, t) {
1541
+ function R(e, t) {
1542
1542
  this.v = e, this.k = t;
1543
1543
  }
1544
1544
  function lt(e, t) {
@@ -1587,7 +1587,7 @@ function ht(e) {
1587
1587
  var t, n;
1588
1588
  function r(t, n) {
1589
1589
  try {
1590
- var a = e[t](n), o = a.value, s = o instanceof ct;
1590
+ var a = e[t](n), o = a.value, s = o instanceof R;
1591
1591
  Promise.resolve(s ? o.v : o).then(function(n) {
1592
1592
  if (s) {
1593
1593
  var c = t === "return" && o.k ? t : "next";
@@ -1630,7 +1630,7 @@ ht.prototype[typeof Symbol == "function" && Symbol.asyncIterator || "@@asyncIter
1630
1630
  }, ht.prototype.return = function(e) {
1631
1631
  return this._invoke("return", e);
1632
1632
  };
1633
- var gt = Object.entries, z = Object.setPrototypeOf, _t = Object.isFrozen, vt = Object.getPrototypeOf, yt = Object.getOwnPropertyDescriptor, B = Object.freeze, V = Object.seal, bt = Object.create, xt = typeof Reflect < "u" && Reflect, St = xt.apply, Ct = xt.construct;
1633
+ var gt = Object.entries, _t = Object.setPrototypeOf, vt = Object.isFrozen, yt = Object.getPrototypeOf, z = Object.getOwnPropertyDescriptor, B = Object.freeze, V = Object.seal, bt = Object.create, xt = typeof Reflect < "u" && Reflect, St = xt.apply, Ct = xt.construct;
1634
1634
  B ||= function(e) {
1635
1635
  return e;
1636
1636
  }, V ||= function(e) {
@@ -1641,11 +1641,9 @@ B ||= function(e) {
1641
1641
  }, Ct ||= function(e) {
1642
1642
  return new e(...[...arguments].slice(1));
1643
1643
  };
1644
- var wt = K(Array.prototype.forEach);
1644
+ var H = K(Array.prototype.forEach);
1645
1645
  Array.prototype.indexOf;
1646
- var Tt = K(Array.prototype.lastIndexOf), Et = K(Array.prototype.pop), Dt = K(Array.prototype.push);
1647
- Array.prototype.slice;
1648
- var Ot = K(Array.prototype.splice), kt = Array.isArray, At = K(String.prototype.toLowerCase), jt = K(String.prototype.toString), Mt = K(String.prototype.match), Nt = K(String.prototype.replace), Pt = K(String.prototype.indexOf), Ft = K(String.prototype.trim), It = K(Number.prototype.toString), Lt = K(Boolean.prototype.toString), Rt = typeof BigInt > "u" ? null : K(BigInt.prototype.toString), zt = typeof Symbol > "u" ? null : K(Symbol.prototype.toString), H = K(Object.prototype.hasOwnProperty), U = K(Object.prototype.toString), W = K(RegExp.prototype.test), G = Bt(TypeError);
1646
+ var wt = K(Array.prototype.lastIndexOf), Tt = K(Array.prototype.pop), Et = K(Array.prototype.push), Dt = K(Array.prototype.slice), Ot = K(Array.prototype.splice), kt = Array.isArray, At = Wt(Set), jt = K(Set.prototype.add), Mt = K(Set.prototype.has), Nt = K(String.prototype.toLowerCase), Pt = K(String.prototype.toString), Ft = K(String.prototype.match), It = K(String.prototype.replace), Lt = K(String.prototype.indexOf), Rt = K(String.prototype.trim), zt = K(Number.prototype.toString), Bt = K(Boolean.prototype.toString), Vt = typeof BigInt > "u" ? null : K(BigInt.prototype.toString), Ht = typeof Symbol > "u" ? null : K(Symbol.prototype.toString), U = K(Object.prototype.hasOwnProperty), Ut = K(Object.prototype.toString), W = K(RegExp.prototype.test), G = Wt(TypeError);
1649
1647
  function K(e) {
1650
1648
  return function(t) {
1651
1649
  t instanceof RegExp && (t.lastIndex = 0);
@@ -1653,27 +1651,27 @@ function K(e) {
1653
1651
  return St(e, t, n);
1654
1652
  };
1655
1653
  }
1656
- function Bt(e) {
1654
+ function Wt(e) {
1657
1655
  return function() {
1658
1656
  return Ct(e, [...arguments]);
1659
1657
  };
1660
1658
  }
1661
1659
  function q(e, t) {
1662
- let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : At;
1663
- if (z && z(e, null), !kt(t)) return e;
1660
+ let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Nt;
1661
+ if (_t && _t(e, null), !kt(t)) return e;
1664
1662
  let r = t.length;
1665
1663
  for (; r--;) {
1666
1664
  let i = t[r];
1667
1665
  if (typeof i == "string") {
1668
1666
  let e = n(i);
1669
- e !== i && (_t(t) || (t[r] = e), i = e);
1667
+ e !== i && (vt(t) || (t[r] = e), i = e);
1670
1668
  }
1671
1669
  e[i] = !0;
1672
1670
  }
1673
1671
  return e;
1674
1672
  }
1675
- function Vt(e) {
1676
- for (let t = 0; t < e.length; t++) H(e, t) || (e[t] = null);
1673
+ function Gt(e) {
1674
+ for (let t = 0; t < e.length; t++) U(e, t) || (e[t] = null);
1677
1675
  return e;
1678
1676
  }
1679
1677
  function J(e) {
@@ -1681,53 +1679,61 @@ function J(e) {
1681
1679
  for (let r of gt(e)) {
1682
1680
  var n = pt(r, 2);
1683
1681
  let i = n[0], a = n[1];
1684
- H(e, i) && (t[i] = kt(a) ? Vt(a) : a && typeof a == "object" && a.constructor === Object ? J(a) : a);
1682
+ U(e, i) && (t[i] = kt(a) ? Gt(a) : a && typeof a == "object" && a.constructor === Object ? J(a) : a);
1685
1683
  }
1686
1684
  return t;
1687
1685
  }
1688
- function Ht(e) {
1686
+ function Kt(e) {
1689
1687
  switch (typeof e) {
1690
1688
  case "string": return e;
1691
- case "number": return It(e);
1692
- case "boolean": return Lt(e);
1693
- case "bigint": return Rt ? Rt(e) : "0";
1694
- case "symbol": return zt ? zt(e) : "Symbol()";
1695
- case "undefined": return U(e);
1689
+ case "number": return zt(e);
1690
+ case "boolean": return Bt(e);
1691
+ case "bigint": return Vt ? Vt(e) : "0";
1692
+ case "symbol": return Ht ? Ht(e) : "Symbol()";
1693
+ case "undefined": return Ut(e);
1696
1694
  case "function":
1697
1695
  case "object": {
1698
- if (e === null) return U(e);
1696
+ if (e === null) return Ut(e);
1699
1697
  let t = e, n = Y(t, "toString");
1700
1698
  if (typeof n == "function") {
1701
1699
  let e = n(t);
1702
- return typeof e == "string" ? e : U(e);
1700
+ return typeof e == "string" ? e : Ut(e);
1703
1701
  }
1704
- return U(e);
1702
+ return Ut(e);
1705
1703
  }
1706
- default: return U(e);
1704
+ default: return Ut(e);
1707
1705
  }
1708
1706
  }
1709
1707
  function Y(e, t) {
1710
1708
  for (; e !== null;) {
1711
- let n = yt(e, t);
1709
+ let n = z(e, t);
1712
1710
  if (n) {
1713
1711
  if (n.get) return K(n.get);
1714
1712
  if (typeof n.value == "function") return K(n.value);
1715
1713
  }
1716
- e = vt(e);
1714
+ e = yt(e);
1717
1715
  }
1718
1716
  function n() {
1719
1717
  return null;
1720
1718
  }
1721
1719
  return n;
1722
1720
  }
1723
- function Ut(e) {
1721
+ function qt(e, t) {
1722
+ for (; e !== null;) {
1723
+ let n = z(e, t);
1724
+ if (n) return n.get ? K(n.get) : null;
1725
+ e = yt(e);
1726
+ }
1727
+ return null;
1728
+ }
1729
+ function Jt(e) {
1724
1730
  try {
1725
1731
  return W(e, ""), !0;
1726
1732
  } catch {
1727
1733
  return !1;
1728
1734
  }
1729
1735
  }
1730
- var Wt = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr".split(".")), Gt = B(/* @__PURE__ */ "svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern".split(".")), Kt = B([
1736
+ var Yt = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr".split(".")), Xt = B(/* @__PURE__ */ "svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern".split(".")), Zt = B([
1731
1737
  "feBlend",
1732
1738
  "feColorMatrix",
1733
1739
  "feComponentTransfer",
@@ -1753,7 +1759,7 @@ var Wt = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
1753
1759
  "feSpotLight",
1754
1760
  "feTile",
1755
1761
  "feTurbulence"
1756
- ]), qt = B([
1762
+ ]), Qt = B([
1757
1763
  "animate",
1758
1764
  "color-profile",
1759
1765
  "cursor",
@@ -1776,7 +1782,7 @@ var Wt = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
1776
1782
  "solidcolor",
1777
1783
  "unknown",
1778
1784
  "use"
1779
- ]), Jt = B(/* @__PURE__ */ "math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts".split(".")), Yt = B([
1785
+ ]), $t = B(/* @__PURE__ */ "math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts".split(".")), en = B([
1780
1786
  "maction",
1781
1787
  "maligngroup",
1782
1788
  "malignmark",
@@ -1792,13 +1798,13 @@ var Wt = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
1792
1798
  "annotation-xml",
1793
1799
  "mprescripts",
1794
1800
  "none"
1795
- ]), Xt = B(["#text"]), Zt = B(/* @__PURE__ */ "accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns".split(".")), Qt = B(/* @__PURE__ */ "accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan".split(".")), $t = B(/* @__PURE__ */ "accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns".split(".")), en = B([
1801
+ ]), tn = B(["#text"]), nn = B(/* @__PURE__ */ "accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns".split(".")), rn = B(/* @__PURE__ */ "accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan".split(".")), an = B(/* @__PURE__ */ "accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns".split(".")), on = B([
1796
1802
  "xlink:href",
1797
1803
  "xml:id",
1798
1804
  "xlink:title",
1799
1805
  "xml:space",
1800
1806
  "xmlns:xlink"
1801
- ]), tn = V(/{{[\w\W]*|^[\w\W]*}}/g), nn = V(/<%[\w\W]*|^[\w\W]*%>/g), rn = V(/\${[\w\W]*/g), an = V(/^data-[\-\w.\u00B7-\uFFFF]+$/), on = V(/^aria-[\-\w]+$/), sn = V(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), cn = V(/^(?:\w+script|data):/i), ln = V(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), un = V(/^html$/i), dn = V(/^[a-z][.\w]*(-[.\w]+)+$/i), fn = V(/<[/\w!]/g), pn = V(/<[/\w]/g), mn = V(/<\/no(script|embed|frames)/i), hn = V(/\/>/i), X = {
1807
+ ]), sn = V(/{{[\w\W]*|^[\w\W]*}}/g), cn = V(/<%[\w\W]*|^[\w\W]*%>/g), ln = V(/\${[\w\W]*/g), un = V(/^data-[\-\w.\u00B7-\uFFFF]+$/), dn = V(/^aria-[\-\w]+$/), fn = V(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), pn = V(/^(?:\w+script|data):/i), mn = V(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), hn = V(/^html$/i), gn = V(/^[a-z][.\w]*(-[.\w]+)+$/i), _n = V(/<[/\w!]/g), vn = V(/<[/\w]/g), yn = V(/<\/no(script|embed|frames)/i), bn = V(/\/>/i), X = {
1802
1808
  element: 1,
1803
1809
  attribute: 2,
1804
1810
  text: 3,
@@ -1811,7 +1817,7 @@ var Wt = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
1811
1817
  documentType: 10,
1812
1818
  documentFragment: 11,
1813
1819
  notation: 12
1814
- }, Z = [
1820
+ }, xn = B(q({}, [
1815
1821
  "style",
1816
1822
  "script",
1817
1823
  "xmp",
@@ -1820,14 +1826,9 @@ var Wt = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
1820
1826
  "noframes",
1821
1827
  "plaintext",
1822
1828
  "noscript"
1823
- ], gn = B(q({}, Z)), _n = function() {
1824
- let e = {};
1825
- return wt(Z, (t) => {
1826
- e[t] = V(RegExp("</" + t + "(?=[\\t\\n\\f\\r />])", "i"));
1827
- }), B(e);
1828
- }(), vn = function() {
1829
+ ])), Sn = function() {
1829
1830
  return typeof window > "u" ? null : window;
1830
- }, yn = function(e, t) {
1831
+ }, Cn = function(e, t) {
1831
1832
  if (typeof e != "object" || typeof e.createPolicy != "function") return null;
1832
1833
  let n = null, r = "data-tt-policy-suffix";
1833
1834
  t && t.hasAttribute(r) && (n = t.getAttribute(r));
@@ -1844,7 +1845,7 @@ var Wt = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
1844
1845
  } catch {
1845
1846
  return console.warn("TrustedTypes policy " + i + " could not be created."), null;
1846
1847
  }
1847
- }, bn = function() {
1848
+ }, wn = function() {
1848
1849
  return {
1849
1850
  afterSanitizeAttributes: [],
1850
1851
  afterSanitizeElements: [],
@@ -1856,59 +1857,61 @@ var Wt = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
1856
1857
  uponSanitizeElement: [],
1857
1858
  uponSanitizeShadowNode: []
1858
1859
  };
1859
- }, xn = function(e, t, n, r) {
1860
- return H(e, t) && kt(e[t]) ? q(r.base ? J(r.base) : {}, e[t], r.transform) : n;
1861
- }, Sn = function(e, t, n) {
1862
- let r = H(e, t) ? e[t] : void 0;
1860
+ }, Tn = function(e, t, n, r) {
1861
+ return U(e, t) && kt(e[t]) ? q(r.base ? J(r.base) : {}, e[t], r.transform) : n;
1862
+ }, En = function(e, t, n) {
1863
+ let r = U(e, t) ? e[t] : void 0;
1863
1864
  return r && typeof r == "object" ? J(r) : n();
1864
1865
  };
1865
- function Cn() {
1866
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : vn(), t = (e) => Cn(e);
1867
- if (t.version = "3.4.16", t.removed = [], !e || !e.document || e.document.nodeType !== X.document || !e.Element) return t.isSupported = !1, t;
1866
+ function Dn() {
1867
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Sn(), t = (e) => Dn(e);
1868
+ if (t.version = "3.4.17", t.removed = [], !e || !e.document || e.document.nodeType !== X.document || !e.Element) return t.isSupported = !1, t;
1868
1869
  let n = e.document, r = n, i = r.currentScript;
1869
1870
  e.DocumentFragment;
1870
1871
  let a = e.HTMLTemplateElement, o = e.Node, s = e.Element, c = e.NodeFilter;
1871
1872
  e.NamedNodeMap === void 0 && (e.NamedNodeMap || e.MozNamedAttrMap), e.HTMLFormElement;
1872
- let l = e.DOMParser, u = e.trustedTypes, d = s.prototype, f = Y(d, "cloneNode"), p = Y(d, "remove"), m = Y(d, "removeAttributeNode"), h = Y(d, "nextSibling"), g = Y(d, "childNodes"), _ = Y(d, "parentNode"), v = Y(d, "shadowRoot"), ee = Y(d, "attributes"), te = o && o.prototype ? Y(o.prototype, "nodeType") : null, ne = o && o.prototype ? Y(o.prototype, "nodeName") : null, y = o && o.prototype ? Y(o.prototype, "ownerDocument") : null, b = function(e) {
1873
- return te ? te(e) : e.nodeType;
1874
- }, re = function(e) {
1875
- return ne ? ne(e) : e.nodeName;
1873
+ let l = e.DOMParser, u = e.trustedTypes, d = s.prototype, f = Y(d, "cloneNode"), p = Y(d, "remove"), m = Y(d, "removeAttributeNode"), ee = Y(d, "nextSibling"), te = Y(d, "childNodes"), h = Y(d, "parentNode"), g = Y(d, "shadowRoot"), ne = Y(d, "attributes"), re = o && o.prototype ? Y(o.prototype, "nodeType") : null, ie = o && o.prototype ? Y(o.prototype, "nodeName") : null, _ = o && o.prototype ? Y(o.prototype, "ownerDocument") : null, v = function(e) {
1874
+ return re ? re(e) : e.nodeType;
1875
+ }, ae = function(e) {
1876
+ return ie ? ie(e) : e.nodeName;
1877
+ }, oe = qt(d, "namespaceURI"), se = function(e) {
1878
+ return oe ? oe(e) : e.namespaceURI;
1876
1879
  };
1877
1880
  if (typeof a == "function") {
1878
1881
  let e = n.createElement("template");
1879
1882
  e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
1880
1883
  }
1881
- let x, ie = "", ae, oe = !1, se = 0, ce = function() {
1882
- if (se > 0) throw G("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
1883
- }, le = function(e) {
1884
- ce(), se++;
1884
+ let y, b = "", ce, le = !1, ue = 0, de = function() {
1885
+ if (ue > 0) throw G("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
1886
+ }, fe = function(e) {
1887
+ de(), ue++;
1885
1888
  try {
1886
- return x.createHTML(e);
1889
+ return y.createHTML(e);
1887
1890
  } finally {
1888
- se--;
1891
+ ue--;
1889
1892
  }
1890
- }, ue = function(e) {
1891
- ce(), se++;
1893
+ }, pe = function(e) {
1894
+ de(), ue++;
1892
1895
  try {
1893
- return x.createScriptURL(e);
1896
+ return y.createScriptURL(e);
1894
1897
  } finally {
1895
- se--;
1896
- }
1897
- }, de = function() {
1898
- return oe ||= (ae = yn(u, i), !0), ae;
1899
- }, fe = n, pe = fe.implementation, S = fe.createNodeIterator, me = fe.createDocumentFragment, he = fe.getElementsByTagName, ge = r.importNode, C = bn();
1900
- t.isSupported = typeof gt == "function" && typeof _ == "function" && pe && pe.createHTMLDocument !== void 0;
1901
- let _e = tn, ve = nn, ye = rn, be = an, xe = on, Se = cn, Ce = ln, we = dn, Te = sn, w = null, Ee = q({}, [
1902
- ...Wt,
1903
- ...Gt,
1904
- ...Kt,
1905
- ...Jt,
1906
- ...Xt
1907
- ]), T = null, De = q({}, [
1898
+ ue--;
1899
+ }
1900
+ }, me = function() {
1901
+ return le ||= (ce = Cn(u, i), !0), ce;
1902
+ }, x = n, S = x.implementation, he = x.createNodeIterator, ge = x.createDocumentFragment, _e = x.getElementsByTagName, ve = r.importNode, C = wn();
1903
+ t.isSupported = typeof gt == "function" && typeof h == "function" && S && S.createHTMLDocument !== void 0;
1904
+ let ye = sn, be = cn, xe = ln, Se = un, Ce = dn, we = pn, Te = mn, Ee = gn, De = fn, w = null, Oe = q({}, [
1905
+ ...Yt,
1906
+ ...Xt,
1908
1907
  ...Zt,
1909
- ...Qt,
1910
1908
  ...$t,
1911
- ...en
1909
+ ...tn
1910
+ ]), T = null, ke = q({}, [
1911
+ ...nn,
1912
+ ...rn,
1913
+ ...an,
1914
+ ...on
1912
1915
  ]), E = Object.seal(bt(null, {
1913
1916
  tagNameCheck: {
1914
1917
  writable: !0,
@@ -1928,7 +1931,7 @@ function Cn() {
1928
1931
  enumerable: !0,
1929
1932
  value: !1
1930
1933
  }
1931
- })), Oe = null, ke = null, D = Object.seal(bt(null, {
1934
+ })), Ae = null, je = null, D = Object.seal(bt(null, {
1932
1935
  tagCheck: {
1933
1936
  writable: !0,
1934
1937
  configurable: !1,
@@ -1941,14 +1944,14 @@ function Cn() {
1941
1944
  enumerable: !0,
1942
1945
  value: null
1943
1946
  }
1944
- })), Ae = !0, je = !0, Me = !1, Ne = !0, O = !1, Pe = !0, Fe = !1, Ie = !1, Le = null, Re = null, ze = !1, Be = !1, Ve = !1, He = !1, Ue = !0, We = !1, Ge = "user-content-", Ke = !0, qe = !1, Je = {}, Ye = null, k = q({}, /* @__PURE__ */ "annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp".split(".")), Xe = null, Ze = q({}, [
1947
+ })), Me = !0, Ne = !0, Pe = !1, Fe = !0, O = !1, Ie = !0, k = !1, Le = !1, Re = null, ze = null, Be = !1, A = !1, Ve = !1, He = !1, Ue = !0, We = !1, Ge = "user-content-", Ke = !0, qe = !1, j = null, Je = {}, M = null, Ye = q({}, /* @__PURE__ */ "annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp".split(".")), N = null, Xe = q({}, [
1945
1948
  "audio",
1946
1949
  "video",
1947
1950
  "img",
1948
1951
  "source",
1949
1952
  "image",
1950
1953
  "track"
1951
- ]), Qe = null, A = q({}, [
1954
+ ]), Ze = null, Qe = q({}, [
1952
1955
  "alt",
1953
1956
  "class",
1954
1957
  "for",
@@ -1963,77 +1966,72 @@ function Cn() {
1963
1966
  "value",
1964
1967
  "style",
1965
1968
  "xmlns"
1966
- ]), $e = "http://www.w3.org/1998/Math/MathML", j = "http://www.w3.org/2000/svg", M = "http://www.w3.org/1999/xhtml", N = M, et = !1, tt = null, nt = q({}, [
1969
+ ]), $e = "http://www.w3.org/1998/Math/MathML", et = "http://www.w3.org/2000/svg", P = "http://www.w3.org/1999/xhtml", tt = P, nt = !1, F = null, rt = q({}, [
1967
1970
  $e,
1968
- j,
1969
- M
1970
- ], jt), rt = B([
1971
+ et,
1972
+ P
1973
+ ], Pt), it = B([
1971
1974
  "mi",
1972
1975
  "mo",
1973
1976
  "mn",
1974
1977
  "ms",
1975
1978
  "mtext"
1976
- ]), P = q({}, rt), it = B(["annotation-xml"]), at = q({}, it), F = q({}, [
1979
+ ]), I = q({}, it), at = B(["annotation-xml"]), ot = q({}, at), st = q({}, [
1977
1980
  "title",
1978
1981
  "style",
1979
1982
  "font",
1980
1983
  "a",
1981
1984
  "script"
1982
- ]), I = null, ot = ["application/xhtml+xml", "text/html"], L = null, R = null, st = n.createElement("form"), ct = function(e) {
1985
+ ]), L = null, ct = ["application/xhtml+xml", "text/html"], R = null, lt = null, ut = n.createElement("form"), dt = function(e) {
1983
1986
  return e instanceof RegExp || e instanceof Function;
1984
- }, lt = function() {
1987
+ }, ft = function() {
1985
1988
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1986
- if (R && R === e) return;
1987
- (!e || typeof e != "object") && (e = {}), e = J(e), I = ot.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, L = I === "application/xhtml+xml" ? jt : At, w = xn(e, "ALLOWED_TAGS", Ee, { transform: L }), T = xn(e, "ALLOWED_ATTR", De, { transform: L }), tt = xn(e, "ALLOWED_NAMESPACES", nt, { transform: jt }), Qe = xn(e, "ADD_URI_SAFE_ATTR", A, {
1988
- transform: L,
1989
- base: A
1990
- }), Xe = xn(e, "ADD_DATA_URI_TAGS", Ze, {
1991
- transform: L,
1992
- base: Ze
1993
- }), Ye = xn(e, "FORBID_CONTENTS", k, { transform: L }), Oe = xn(e, "FORBID_TAGS", J({}), { transform: L }), ke = xn(e, "FORBID_ATTR", J({}), { transform: L }), Je = H(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? J(e.USE_PROFILES) : e.USE_PROFILES : !1, Ae = e.ALLOW_ARIA_ATTR !== !1, je = e.ALLOW_DATA_ATTR !== !1, Me = e.ALLOW_UNKNOWN_PROTOCOLS || !1, Ne = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, O = e.SAFE_FOR_TEMPLATES || !1, Pe = e.SAFE_FOR_XML !== !1, Fe = e.WHOLE_DOCUMENT || !1, Be = e.RETURN_DOM || !1, Ve = e.RETURN_DOM_FRAGMENT || !1, He = e.RETURN_TRUSTED_TYPE || !1, ze = e.FORCE_BODY || !1, Ue = e.SANITIZE_DOM !== !1, We = e.SANITIZE_NAMED_PROPS || !1, Ke = e.KEEP_CONTENT !== !1, qe = e.IN_PLACE || !1, Te = Ut(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : sn, N = typeof e.NAMESPACE == "string" ? e.NAMESPACE : M, P = Sn(e, "MATHML_TEXT_INTEGRATION_POINTS", () => q({}, rt)), at = Sn(e, "HTML_INTEGRATION_POINTS", () => q({}, it));
1994
- let t = Sn(e, "CUSTOM_ELEMENT_HANDLING", () => bt(null));
1995
- if (E = bt(null), H(t, "tagNameCheck") && ct(t.tagNameCheck) && (E.tagNameCheck = t.tagNameCheck), H(t, "attributeNameCheck") && ct(t.attributeNameCheck) && (E.attributeNameCheck = t.attributeNameCheck), H(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (E.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), V(E), O && (je = !1), Ve && (Be = !0), Je && (w = q({}, Xt), T = bt(null), Je.html === !0 && (q(w, Wt), q(T, Zt)), Je.svg === !0 && (q(w, Gt), q(T, Qt), q(T, en)), Je.svgFilters === !0 && (q(w, Kt), q(T, Qt), q(T, en)), Je.mathMl === !0 && (q(w, Jt), q(T, $t), q(T, en))), D.tagCheck = null, D.attributeCheck = null, H(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? D.tagCheck = e.ADD_TAGS : kt(e.ADD_TAGS) && (w === Ee && (w = J(w)), q(w, e.ADD_TAGS, L))), H(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? D.attributeCheck = e.ADD_ATTR : kt(e.ADD_ATTR) && (T === De && (T = J(T)), q(T, e.ADD_ATTR, L))), H(e, "ADD_FORBID_CONTENTS") && kt(e.ADD_FORBID_CONTENTS) && (Ye === k && (Ye = J(Ye)), q(Ye, e.ADD_FORBID_CONTENTS, L)), Ke && (w["#text"] = !0), Fe && q(w, [
1989
+ if (lt && lt === e) return;
1990
+ (!e || typeof e != "object") && (e = {}), e = J(e), L = ct.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, R = L === "application/xhtml+xml" ? Pt : Nt, w = Tn(e, "ALLOWED_TAGS", Oe, { transform: R }), T = Tn(e, "ALLOWED_ATTR", ke, { transform: R }), F = Tn(e, "ALLOWED_NAMESPACES", rt, { transform: Pt }), Ze = Tn(e, "ADD_URI_SAFE_ATTR", Qe, {
1991
+ transform: R,
1992
+ base: Qe
1993
+ }), N = Tn(e, "ADD_DATA_URI_TAGS", Xe, {
1994
+ transform: R,
1995
+ base: Xe
1996
+ }), M = Tn(e, "FORBID_CONTENTS", Ye, { transform: R }), Ae = Tn(e, "FORBID_TAGS", J({}), { transform: R }), je = Tn(e, "FORBID_ATTR", J({}), { transform: R }), Je = U(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? J(e.USE_PROFILES) : e.USE_PROFILES : !1, Me = e.ALLOW_ARIA_ATTR !== !1, Ne = e.ALLOW_DATA_ATTR !== !1, Pe = e.ALLOW_UNKNOWN_PROTOCOLS || !1, Fe = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, O = e.SAFE_FOR_TEMPLATES || !1, Ie = e.SAFE_FOR_XML !== !1, k = e.WHOLE_DOCUMENT || !1, A = e.RETURN_DOM || !1, Ve = e.RETURN_DOM_FRAGMENT || !1, He = e.RETURN_TRUSTED_TYPE || !1, Be = e.FORCE_BODY || !1, Ue = e.SANITIZE_DOM !== !1, We = e.SANITIZE_NAMED_PROPS || !1, Ke = e.KEEP_CONTENT !== !1, qe = e.IN_PLACE || !1, De = Jt(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : fn, tt = typeof e.NAMESPACE == "string" ? e.NAMESPACE : P, I = En(e, "MATHML_TEXT_INTEGRATION_POINTS", () => q({}, it)), ot = En(e, "HTML_INTEGRATION_POINTS", () => q({}, at));
1997
+ let t = En(e, "CUSTOM_ELEMENT_HANDLING", () => bt(null));
1998
+ if (E = bt(null), U(t, "tagNameCheck") && dt(t.tagNameCheck) && (E.tagNameCheck = t.tagNameCheck), U(t, "attributeNameCheck") && dt(t.attributeNameCheck) && (E.attributeNameCheck = t.attributeNameCheck), U(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (E.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), V(E), O && (Ne = !1), Ve && (A = !0), Je && (w = q({}, tn), T = bt(null), Je.html === !0 && (q(w, Yt), q(T, nn)), Je.svg === !0 && (q(w, Xt), q(T, rn), q(T, on)), Je.svgFilters === !0 && (q(w, Zt), q(T, rn), q(T, on)), Je.mathMl === !0 && (q(w, $t), q(T, an), q(T, on))), D.tagCheck = null, D.attributeCheck = null, U(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? D.tagCheck = e.ADD_TAGS : kt(e.ADD_TAGS) && (w === Oe && (w = J(w)), q(w, e.ADD_TAGS, R))), U(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? D.attributeCheck = e.ADD_ATTR : kt(e.ADD_ATTR) && (T === ke && (T = J(T)), q(T, e.ADD_ATTR, R))), U(e, "ADD_FORBID_CONTENTS") && kt(e.ADD_FORBID_CONTENTS) && (M === Ye && (M = J(M)), q(M, e.ADD_FORBID_CONTENTS, R)), Ke && (w["#text"] = !0), k && q(w, [
1996
1999
  "html",
1997
2000
  "head",
1998
2001
  "body"
1999
- ]), w.table && (q(w, ["tbody"]), delete Oe.tbody), e.TRUSTED_TYPES_POLICY) {
2002
+ ]), w.table && (q(w, ["tbody"]), delete Ae.tbody), e.TRUSTED_TYPES_POLICY) {
2000
2003
  if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw G("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
2001
2004
  if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw G("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
2002
- let t = x;
2003
- x = e.TRUSTED_TYPES_POLICY;
2005
+ let t = y;
2006
+ y = e.TRUSTED_TYPES_POLICY;
2004
2007
  try {
2005
- ie = le("");
2008
+ b = fe("");
2006
2009
  } catch (e) {
2007
- throw x = t, e;
2008
- }
2009
- } else e.TRUSTED_TYPES_POLICY === null ? (x = void 0, ie = "") : (x === void 0 && (x = de()), x && typeof ie == "string" && (ie = le("")));
2010
- B && B(e), R = e;
2011
- }, ut = q({}, [
2012
- ...Gt,
2013
- ...Kt,
2014
- ...qt
2015
- ]), dt = q({}, [...Jt, ...Yt]), ft = function(e, t, n) {
2016
- return t.namespaceURI === M ? e === "svg" : t.namespaceURI === $e ? e === "svg" && (n === "annotation-xml" || P[n]) : !!ut[e];
2017
- }, pt = function(e, t, n) {
2018
- return t.namespaceURI === M ? e === "math" : t.namespaceURI === j ? e === "math" && at[n] : !!dt[e];
2019
- }, mt = function(e, t, n) {
2020
- return t.namespaceURI === j && !at[n] || t.namespaceURI === $e && !P[n] ? !1 : !dt[e] && (F[e] || !ut[e]);
2021
- }, ht = function(e) {
2022
- let t = _(e);
2023
- (!t || !t.tagName) && (t = {
2024
- namespaceURI: N,
2025
- tagName: "template"
2026
- });
2027
- let n = At(e.tagName), r = At(t.tagName);
2028
- return tt[e.namespaceURI] ? e.namespaceURI === j ? ft(n, t, r) : e.namespaceURI === $e ? pt(n, t, r) : e.namespaceURI === M ? mt(n, t, r) : !!(I === "application/xhtml+xml" && tt[e.namespaceURI]) : !1;
2010
+ throw y = t, e;
2011
+ }
2012
+ } else e.TRUSTED_TYPES_POLICY === null ? (y = void 0, b = "") : (y === void 0 && (y = me()), y && typeof b == "string" && (b = fe("")));
2013
+ B && B(e), lt = e;
2014
+ }, pt = q({}, [
2015
+ ...Xt,
2016
+ ...Zt,
2017
+ ...Qt
2018
+ ]), mt = q({}, [...$t, ...en]), ht = function(e, t, n) {
2019
+ return t.namespaceURI === P ? e === "svg" : t.namespaceURI === $e ? e === "svg" && (n === "annotation-xml" || I[n]) : !!pt[e];
2020
+ }, _t = function(e, t, n) {
2021
+ return t.namespaceURI === P ? e === "math" : t.namespaceURI === et ? e === "math" && ot[n] : !!mt[e];
2022
+ }, vt = function(e, t, n) {
2023
+ return t.namespaceURI === et && !ot[n] || t.namespaceURI === $e && !I[n] ? !1 : !mt[e] && (st[e] || !pt[e]);
2024
+ }, yt = function(e) {
2025
+ let t = se(e), n = Nt(ae(e)), r = h(e), i, a;
2026
+ return r && v(r) === X.element ? (i = { namespaceURI: se(r) }, a = Nt(ae(r))) : (i = { namespaceURI: tt }, a = "template"), F[t] ? t === et ? ht(n, i, a) : t === $e ? _t(n, i, a) : t === P ? vt(n, i, a) : !!(L === "application/xhtml+xml" && F[t]) : !1;
2029
2027
  }, z = function(e) {
2030
- Dt(t.removed, { element: e });
2028
+ Et(t.removed, { element: e });
2031
2029
  try {
2032
- _(e).removeChild(e);
2030
+ h(e).removeChild(e);
2033
2031
  } catch {
2034
- if (p(e), !_(e)) throw G("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
2032
+ if (p(e), !h(e)) throw G("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
2035
2033
  }
2036
- }, _t = function(e, t, n) {
2034
+ }, xt = function(e, t, n) {
2037
2035
  try {
2038
2036
  m(e, t);
2039
2037
  } catch {
@@ -2041,31 +2039,26 @@ function Cn() {
2041
2039
  e.removeAttribute(n);
2042
2040
  } catch {}
2043
2041
  }
2044
- }, vt = function(e) {
2045
- St(e);
2046
- let t = g(e);
2047
- if (t) {
2048
- let e = [];
2049
- wt(t, (t) => {
2050
- Dt(e, t);
2051
- }), wt(e, (e) => {
2052
- try {
2053
- p(e);
2054
- } catch {}
2055
- });
2056
- }
2057
- let n = ee(e);
2042
+ }, St = function(e) {
2043
+ Vt(e);
2044
+ let t = te(e);
2045
+ t && H(Dt(t), (e) => {
2046
+ try {
2047
+ p(e);
2048
+ } catch {}
2049
+ });
2050
+ let n = v(e) === X.element ? ne(e) : null;
2058
2051
  if (n) for (let t = n.length - 1; t >= 0; --t) {
2059
2052
  let r = n[t], i = r && r.name;
2060
- typeof i == "string" && _t(e, r, i);
2053
+ typeof i == "string" && xt(e, r, i);
2061
2054
  }
2062
- }, yt = function(e, n, r) {
2055
+ }, Ct = function(e, n, r) {
2063
2056
  if (!r) try {
2064
2057
  r = n.getAttributeNode(e);
2065
2058
  } catch {
2066
2059
  r = null;
2067
2060
  }
2068
- Dt(t.removed, {
2061
+ Et(t.removed, {
2069
2062
  attribute: r || null,
2070
2063
  from: n
2071
2064
  });
@@ -2077,150 +2070,193 @@ function Cn() {
2077
2070
  } catch {}
2078
2071
  }
2079
2072
  if (e === "is") {
2080
- if (Be || Ve) try {
2073
+ if (A || Ve) try {
2081
2074
  z(n);
2082
2075
  } catch {}
2083
2076
  else try {
2084
2077
  n.setAttribute(e, "");
2085
2078
  } catch {}
2086
2079
  }
2087
- }, xt = function(e) {
2088
- let t = ee(e);
2080
+ }, zt = function(e) {
2081
+ let t = ne(e);
2089
2082
  if (t) for (let n = t.length - 1; n >= 0; --n) {
2090
2083
  let r = t[n], i = r && r.name;
2091
- typeof i != "string" || T[L(i)] || _t(e, r, i);
2084
+ typeof i != "string" || T[R(i)] || xt(e, r, i);
2092
2085
  }
2093
- }, St = function(e) {
2094
- let t = [e];
2095
- for (; t.length > 0;) {
2096
- let e = t.pop();
2097
- b(e) === X.element && xt(e);
2098
- let n = g(e);
2099
- if (n) for (let e = n.length - 1; e >= 0; --e) t.push(n[e]);
2100
- }
2101
- }, Ct = function(e, t) {
2102
- return Pe ? e === "patchsrc" || e === "for" && t !== "label" && t !== "output" : !1;
2103
- }, It = function(e) {
2104
- if (!Pe) return;
2105
- let t = [e];
2106
- for (; t.length > 0;) {
2107
- let e = t.pop(), n = b(e);
2108
- if (n === X.processingInstruction || n === X.comment && W(pn, e.data)) {
2086
+ }, Bt = function(e, t) {
2087
+ let n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2], r = [e];
2088
+ for (; r.length > 0;) {
2089
+ let e = r.pop();
2090
+ if (t(e) === !1) continue;
2091
+ if (n && v(e) === X.element) {
2092
+ let t = g(e);
2093
+ Q(t) && r.push(t);
2094
+ }
2095
+ let i = te(e);
2096
+ if (i) for (let e = i.length - 1; e >= 0; --e) r.push(i[e]);
2097
+ }
2098
+ }, Vt = function(e) {
2099
+ Bt(e, (e) => {
2100
+ v(e) === X.element && zt(e);
2101
+ });
2102
+ }, Ht = function(e) {
2103
+ let t = [];
2104
+ return Bt(e, (e) => {
2105
+ t.push(e);
2106
+ }, !0), t;
2107
+ }, Ut = function(e, t) {
2108
+ let n = At();
2109
+ H(Ht(e), (e) => {
2110
+ v(e) === X.element && jt(n, e);
2111
+ }), H(t, (e) => {
2112
+ v(e) === X.element && !Mt(n, e) && zt(e);
2113
+ });
2114
+ }, K = function(e, n) {
2115
+ let r = !1;
2116
+ return H(t.removed, (t) => {
2117
+ t.element && (r ||= t.element === e, Vt(t.element));
2118
+ }), Ut(e, n), r;
2119
+ }, Wt = function(e, t) {
2120
+ let n = j, r = null, i = () => (r || (r = At(), H(t, (e) => {
2121
+ jt(r, e);
2122
+ })), r);
2123
+ for (let t = 0;; t++) {
2124
+ let r = Ht(e), a = [e], o = !1;
2125
+ if (H(r, (e) => {
2126
+ v(e) === X.documentFragment ? Et(a, e) : !o && !Mt(n, e) && (o = Mt(i(), e));
2127
+ }), !o) return;
2128
+ if (t >= 8) throw G("the tree kept changing during in-place sanitization; refusing to return it");
2129
+ H(a, (t, n) => {
2130
+ Gt(t, n > 0, e, i());
2131
+ });
2132
+ }
2133
+ }, Gt = function(e, t, n, r) {
2134
+ let i = jn(e), a;
2135
+ for (; a = i.nextNode();) Mt(r, a) && !Mt(j, a) && (t && $(C.uponSanitizeShadowNode, a, null), Hn(a, n), Yn(a, n), Q(a.content) && Xn(a.content));
2136
+ }, On = function(e) {
2137
+ j && jt(j, e);
2138
+ }, Z = function(e, t) {
2139
+ return Ie ? e === "patchsrc" || e === "for" && t !== "label" && t !== "output" : !1;
2140
+ }, kn = function(e) {
2141
+ Ie && Bt(e, (e) => {
2142
+ let t = v(e);
2143
+ if (t === X.processingInstruction || t === X.comment && W(vn, e.data)) {
2109
2144
  try {
2110
2145
  p(e);
2111
2146
  } catch {}
2112
- continue;
2147
+ return !1;
2113
2148
  }
2114
- if (n === X.element) {
2115
- let t = e, n = L(re(e));
2149
+ if (t === X.element) {
2150
+ let t = e, n = R(ae(e));
2116
2151
  try {
2117
- t.hasAttribute && t.hasAttribute("patchsrc") && t.removeAttribute("patchsrc"), t.hasAttribute && t.hasAttribute("for") && Ct("for", n) && t.removeAttribute("for");
2152
+ t.hasAttribute && t.hasAttribute("patchsrc") && t.removeAttribute("patchsrc"), t.hasAttribute && t.hasAttribute("for") && Z("for", n) && t.removeAttribute("for");
2118
2153
  } catch {}
2119
2154
  }
2120
- let r = g(e);
2121
- if (r) for (let e = r.length - 1; e >= 0; --e) t.push(r[e]);
2122
- }
2123
- }, Lt = function(e) {
2155
+ return !0;
2156
+ });
2157
+ }, An = function(e) {
2124
2158
  let t = null, r = null;
2125
- if (ze) e = "<remove></remove>" + e;
2159
+ if (Be) e = "<remove></remove>" + e;
2126
2160
  else {
2127
- let t = Mt(e, /^[\r\n\t ]+/);
2161
+ let t = Ft(e, /^[\r\n\t ]+/);
2128
2162
  r = t && t[0];
2129
2163
  }
2130
- I === "application/xhtml+xml" && N === M && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
2131
- let i = x ? le(e) : e;
2132
- if (N === M) try {
2133
- t = new l().parseFromString(i, I);
2164
+ L === "application/xhtml+xml" && tt === P && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
2165
+ let i = y ? fe(e) : e;
2166
+ if (tt === P) try {
2167
+ t = new l().parseFromString(i, L);
2134
2168
  } catch {}
2135
2169
  if (!t || !t.documentElement) {
2136
- t = pe.createDocument(N, "template", null);
2170
+ t = S.createDocument(tt, "template", null);
2137
2171
  try {
2138
- t.documentElement.innerHTML = et ? ie : i;
2172
+ t.documentElement.innerHTML = nt ? b : i;
2139
2173
  } catch {}
2140
2174
  }
2141
2175
  let a = t.body || t.documentElement;
2142
- return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), N === M ? he.call(t, Fe ? "html" : "body")[0] : Fe ? t.documentElement : a;
2143
- }, Rt = function(e) {
2144
- let t = y ? y(e) : e.ownerDocument;
2145
- return S.call(t || e, e, c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION, null);
2146
- }, zt = function(e) {
2147
- return e = Nt(e, _e, " "), e = Nt(e, ve, " "), e = Nt(e, ye, " "), e;
2148
- }, U = function(e) {
2149
- e.normalize();
2150
- let t = y ? y(e) : e.ownerDocument, n = S.call(t || e, e, c.SHOW_TEXT | c.SHOW_COMMENT | c.SHOW_CDATA_SECTION | c.SHOW_PROCESSING_INSTRUCTION, null), r = n.nextNode();
2151
- for (; r;) r.data = zt(r.data), r = n.nextNode();
2152
- let i = e.querySelectorAll?.call(e, "template");
2153
- i && wt(i, (e) => {
2154
- Bt(e.content) && U(e.content);
2176
+ return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), tt === P ? _e.call(t, k ? "html" : "body")[0] : k ? t.documentElement : a;
2177
+ }, jn = function(e) {
2178
+ let t = _ ? _(e) : e.ownerDocument;
2179
+ return he.call(t || e, e, c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION, null);
2180
+ }, Mn = function(e) {
2181
+ return e = It(e, ye, " "), e = It(e, be, " "), e = It(e, xe, " "), e;
2182
+ }, Nn = function(e) {
2183
+ Pn(e);
2184
+ let t = e.querySelectorAll?.call(e, "template");
2185
+ t && H(t, (e) => {
2186
+ Q(e.content) && Nn(e.content);
2155
2187
  });
2156
- }, K = function(e) {
2157
- let t = ne ? ne(e) : null;
2158
- return typeof t != "string" || L(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== ee(e) || typeof e.removeAttribute != "function" || typeof e.removeAttributeNode != "function" || typeof e.getAttributeNode != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== te(e) || e.childNodes !== g(e);
2159
- }, Bt = function(e) {
2160
- if (!te || typeof e != "object" || !e) return !1;
2188
+ }, Pn = function(e) {
2189
+ e.normalize();
2190
+ let t = _ ? _(e) : e.ownerDocument, n = he.call(t || e, e, c.SHOW_TEXT | c.SHOW_COMMENT | c.SHOW_CDATA_SECTION | c.SHOW_PROCESSING_INSTRUCTION, null), r = n.nextNode();
2191
+ for (; r;) r.data = Mn(r.data), r = n.nextNode();
2192
+ }, Fn = function(e) {
2193
+ let t = ie ? ie(e) : null;
2194
+ return typeof t != "string" || R(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== ne(e) || typeof e.removeAttribute != "function" || typeof e.removeAttributeNode != "function" || typeof e.getAttributeNode != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== re(e) || e.childNodes !== te(e);
2195
+ }, Q = function(e) {
2196
+ if (!re || typeof e != "object" || !e) return !1;
2161
2197
  try {
2162
- return te(e) === X.documentFragment;
2198
+ return re(e) === X.documentFragment;
2163
2199
  } catch {
2164
2200
  return !1;
2165
2201
  }
2166
- }, Vt = function(e) {
2167
- if (!te || typeof e != "object" || !e) return !1;
2202
+ }, In = function(e) {
2203
+ if (!re || typeof e != "object" || !e) return !1;
2168
2204
  try {
2169
- return typeof te(e) == "number";
2205
+ return typeof re(e) == "number";
2170
2206
  } catch {
2171
2207
  return !1;
2172
2208
  }
2173
2209
  };
2174
- function Z(e, n, r) {
2175
- e.length !== 0 && wt(e, (e) => {
2176
- e.call(t, n, r, R);
2210
+ function $(e, n, r) {
2211
+ e.length !== 0 && H(e, (e) => {
2212
+ e.call(t, n, r, lt);
2177
2213
  });
2178
2214
  }
2179
- let wn = function(e, t) {
2180
- return !!(Pe && e.hasChildNodes() && !Vt(e.firstElementChild) && W(fn, e.textContent) && W(fn, e.innerHTML) || Pe && e.namespaceURI === M && gn[t] && (Vt(e.firstElementChild) || typeof e.textContent == "string" && W(_n[t], e.textContent)) || e.nodeType === X.processingInstruction || Pe && e.nodeType === X.comment && W(pn, e.data));
2181
- }, Q = function(e, t) {
2215
+ let Ln = function(e, t) {
2216
+ return !!(Ie && e.hasChildNodes() && !In(e.firstElementChild) && W(_n, e.textContent) && W(_n, e.innerHTML) || Ie && xn[t] && v(e) === X.element && se(e) === P && (In(e.firstElementChild) || typeof e.textContent == "string" && W(_n, e.textContent)) || e.nodeType === X.processingInstruction || Ie && e.nodeType === X.comment && W(vn, e.data));
2217
+ }, Rn = function(e, t) {
2182
2218
  return e instanceof RegExp ? W(e, t) : e instanceof Function && !!e(t, ...[...arguments].slice(2));
2183
- }, Tn = function(e, t, n) {
2184
- if (!Oe[t] && jn(t) && Q(E.tagNameCheck, t)) return !1;
2185
- if (Ke && !Ye[t]) {
2186
- let t = _(e), r = g(e);
2219
+ }, zn = function(e, t, n) {
2220
+ if (!Ae[t] && Gn(t) && Rn(E.tagNameCheck, t)) return !1;
2221
+ if (Ke && !M[t] && !M[Nt(t)]) {
2222
+ let t = h(e), r = te(e);
2187
2223
  if (r && t) {
2188
2224
  let i = r.length;
2189
2225
  for (let a = i - 1; a >= 0; --a) {
2190
2226
  let i = e === n ? f(r[a], !0) : r[a];
2191
- t.insertBefore(i, h(e));
2227
+ t.insertBefore(i, ee(e));
2192
2228
  }
2193
2229
  }
2194
2230
  }
2195
2231
  return z(e), !0;
2196
- }, En = function(e, t, n, r) {
2232
+ }, Bn = function(e, t, n, r) {
2197
2233
  return e.length === 0 ? t : t === n || t === r ? J(t) : t;
2198
- }, Dn = function(e, t) {
2199
- return e === t || _(e) !== null ? !1 : (qe && St(e), !0);
2200
- }, On = function(e, n) {
2201
- if (Z(C.beforeSanitizeElements, e, null), Dn(e, n)) return !0;
2202
- if (K(e)) return z(e), !0;
2203
- let r = L(re(e));
2204
- if (w = En(C.uponSanitizeElement, w, Ee, Le), Z(C.uponSanitizeElement, e, {
2234
+ }, Vn = function(e, t) {
2235
+ return e === t || h(e) !== null ? !1 : (qe && Vt(e), !0);
2236
+ }, Hn = function(e, n) {
2237
+ if (On(e), $(C.beforeSanitizeElements, e, null), Vn(e, n)) return !0;
2238
+ if (Fn(e)) return z(e), !0;
2239
+ let r = R(ae(e));
2240
+ if (w = Bn(C.uponSanitizeElement, w, Oe, Re), $(C.uponSanitizeElement, e, {
2205
2241
  tagName: r,
2206
2242
  allowedTags: w
2207
- }), Dn(e, n)) return !0;
2208
- if (wn(e, r)) return z(e), !0;
2209
- if (Oe[r] || !(D.tagCheck instanceof Function && D.tagCheck(r)) && !w[r]) {
2210
- let t = Tn(e, r, n);
2211
- return t === !1 && (Z(C.afterSanitizeElements, e, null), Dn(e, n)) ? !0 : t;
2243
+ }), Vn(e, n)) return !0;
2244
+ if (Ln(e, r)) return z(e), !0;
2245
+ if (Ae[r] || !(D.tagCheck instanceof Function && D.tagCheck(r)) && !w[r]) {
2246
+ let t = zn(e, r, n);
2247
+ return t === !1 && ($(C.afterSanitizeElements, e, null), Vn(e, n)) ? !0 : t;
2212
2248
  }
2213
- if (b(e) === X.element && !ht(e) || (r === "noscript" || r === "noembed" || r === "noframes") && W(mn, e.innerHTML)) return z(e), !0;
2249
+ if (v(e) === X.element && !yt(e) || (r === "noscript" || r === "noembed" || r === "noframes") && W(yn, e.innerHTML)) return z(e), !0;
2214
2250
  if (O && e.nodeType === X.text) {
2215
- let n = zt(e.textContent);
2216
- e.textContent !== n && (Dt(t.removed, { element: e.cloneNode() }), e.textContent = n);
2251
+ let n = Mn(e.textContent);
2252
+ e.textContent !== n && (Et(t.removed, { element: e.cloneNode() }), e.textContent = n);
2217
2253
  }
2218
- return Z(C.afterSanitizeElements, e, null), Dn(e, n);
2219
- }, kn = function(e, t, r) {
2220
- if (ke[t] || Ct(t, e) || Ue && (t === "id" || t === "name") && (r in n || r in st)) return !1;
2254
+ return $(C.afterSanitizeElements, e, null), Vn(e, n);
2255
+ }, Un = function(e, t, r) {
2256
+ if (je[t] || Z(t, e) || Ue && (t === "id" || t === "name") && (r in n || r in ut)) return !1;
2221
2257
  let i = T[t] || D.attributeCheck instanceof Function && D.attributeCheck(t, e);
2222
- return je && W(be, t) || Ae && W(xe, t) ? !0 : i ? Qe[t] || W(Te, Nt(r, Ce, "")) || (t === "src" || t === "xlink:href" || t === "href") && e !== "script" && Pt(r, "data:") === 0 && Xe[e] || Me && !W(Se, Nt(r, Ce, "")) ? !0 : !r : jn(e) && Q(E.tagNameCheck, e) && Q(E.attributeNameCheck, t, e) || t === "is" && E.allowCustomizedBuiltInElements && Q(E.tagNameCheck, r);
2223
- }, An = q({}, [
2258
+ return Ne && W(Se, t) || Me && W(Ce, t) ? !0 : i ? Ze[t] || W(De, It(r, Te, "")) || (t === "src" || t === "xlink:href" || t === "href") && e !== "script" && Lt(r, "data:") === 0 && N[e] || Pe && !W(we, It(r, Te, "")) ? !0 : !r : Gn(e) && Rn(E.tagNameCheck, e) && Rn(E.attributeNameCheck, t, e) || t === "is" && E.allowCustomizedBuiltInElements && Rn(E.tagNameCheck, r);
2259
+ }, Wn = q({}, [
2224
2260
  "annotation-xml",
2225
2261
  "color-profile",
2226
2262
  "font-face",
@@ -2229,67 +2265,65 @@ function Cn() {
2229
2265
  "font-face-src",
2230
2266
  "font-face-uri",
2231
2267
  "missing-glyph"
2232
- ]), jn = function(e) {
2233
- return !An[At(e)] && W(we, e);
2234
- }, Mn = function(e, t, n, r) {
2235
- if (x && typeof u == "object" && typeof u.getAttributeType == "function" && !n) switch (u.getAttributeType(e, t)) {
2236
- case "TrustedHTML": return le(r);
2237
- case "TrustedScriptURL": return ue(r);
2268
+ ]), Gn = function(e) {
2269
+ return !Wn[Nt(e)] && W(Ee, e);
2270
+ }, Kn = function(e, t, n, r) {
2271
+ if (y && typeof u == "object" && typeof u.getAttributeType == "function" && !n) switch (u.getAttributeType(e, t)) {
2272
+ case "TrustedHTML": return fe(r);
2273
+ case "TrustedScriptURL": return pe(r);
2238
2274
  }
2239
2275
  return r;
2240
- }, Nn = function(e, t, n, r) {
2276
+ }, qn = function(e, t, n, r) {
2241
2277
  try {
2242
- return n ? e.setAttributeNS(n, t, r) : e.setAttribute(t, r), !K(e) || (z(e), !1);
2278
+ return n ? e.setAttributeNS(n, t, r) : e.setAttribute(t, r), !Fn(e) || (z(e), !1);
2243
2279
  } catch {
2244
- return yt(t, e), !1;
2280
+ return Ct(t, e), !1;
2245
2281
  }
2246
- }, Pn = function(e, n) {
2247
- if (Z(C.beforeSanitizeAttributes, e, null), Dn(e, n)) return;
2282
+ }, Jn = function(e, t) {
2283
+ return Ie && W(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, t) ? !0 : Nt(e) === "attributename" && Ft(t, "href") !== null;
2284
+ }, Yn = function(e, n) {
2285
+ if ($(C.beforeSanitizeAttributes, e, null), Vn(e, n)) return;
2248
2286
  let r = e.attributes;
2249
- if (!r || K(e)) return;
2250
- T = En(C.uponSanitizeAttribute, T, De, Re);
2287
+ if (!r || Fn(e)) return;
2288
+ T = Bn(C.uponSanitizeAttribute, T, ke, ze);
2251
2289
  let i = {
2252
2290
  attrName: "",
2253
2291
  attrValue: "",
2254
2292
  keepAttr: !0,
2255
2293
  allowedAttributes: T,
2256
2294
  forceKeepAttr: void 0
2257
- }, a = r.length, o = L(e.nodeName);
2295
+ }, a = r.length, o = R(e.nodeName);
2258
2296
  for (; a--;) {
2259
- let n = r[a], s = n.name, c = n.namespaceURI, l = n.value, u = L(s), d = l, f = s === "value" ? d : Ft(d), p = !1;
2260
- if (i.attrName = u, i.attrValue = f, i.keepAttr = !0, i.forceKeepAttr = void 0, Z(C.uponSanitizeAttribute, e, i), f = i.attrValue, We && (u === "id" || u === "name") && Pt(f, Ge) !== 0 && (yt(s, e, n), f = Ge + f, p = !0), Pe && W(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, f)) {
2261
- yt(s, e, n);
2262
- continue;
2263
- }
2264
- if (u === "attributename" && Mt(f, "href")) {
2265
- yt(s, e, n);
2297
+ let n = r[a], s = n.name, c = n.namespaceURI, l = n.value, u = R(s), d = l, f = s === "value" ? d : Rt(d), p = !1;
2298
+ if (i.attrName = u, i.attrValue = f, i.keepAttr = !0, i.forceKeepAttr = void 0, $(C.uponSanitizeAttribute, e, i), f = i.attrValue, We && (u === "id" || u === "name") && Lt(f, Ge) !== 0 && (Ct(s, e, n), f = Ge + f, p = !0), Jn(s, f)) {
2299
+ Ct(s, e, n);
2266
2300
  continue;
2267
2301
  }
2268
2302
  if (!i.forceKeepAttr) {
2269
2303
  if (!i.keepAttr) {
2270
- yt(s, e, n);
2304
+ Ct(s, e, n);
2271
2305
  continue;
2272
2306
  }
2273
- if (!Ne && W(hn, f)) {
2274
- yt(s, e, n);
2307
+ if (!Fe && W(bn, f)) {
2308
+ Ct(s, e, n);
2275
2309
  continue;
2276
2310
  }
2277
- if (O && (f = zt(f)), !kn(o, u, f)) {
2278
- yt(s, e, n);
2311
+ if (O && (f = Mn(f)), !Un(o, u, f)) {
2312
+ Ct(s, e, n);
2279
2313
  continue;
2280
2314
  }
2281
- f = Mn(o, u, c, f), f !== d && Nn(e, s, c, f) && p && Et(t.removed);
2315
+ f = Kn(o, u, c, f), f !== d && qn(e, s, c, f) && p && Tt(t.removed);
2282
2316
  }
2283
2317
  }
2284
- Z(C.afterSanitizeAttributes, e, null), Dn(e, n);
2285
- }, Fn = function(e) {
2286
- let t = null, n = Rt(e);
2287
- for (Z(C.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if (Z(C.uponSanitizeShadowNode, t, null), On(t, e), Pn(t, e), Bt(t.content) && Fn(t.content), b(t) === X.element) {
2288
- let e = v(t);
2289
- Bt(e) && (In(e), Fn(e));
2318
+ $(C.afterSanitizeAttributes, e, null), Vn(e, n);
2319
+ }, Xn = function(e) {
2320
+ let t = null, n = jn(e);
2321
+ for ($(C.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if ($(C.uponSanitizeShadowNode, t, null), Hn(t, e), Yn(t, e), Q(t.content) && Xn(t.content), v(t) === X.element) {
2322
+ let e = g(t);
2323
+ Q(e) && (Zn(e), Xn(e));
2290
2324
  }
2291
- Z(C.afterSanitizeShadowDOM, e, null);
2292
- }, In = function(e) {
2325
+ O && Pn(e), $(C.afterSanitizeShadowDOM, e, null);
2326
+ }, Zn = function(e) {
2293
2327
  let t = [{
2294
2328
  node: e,
2295
2329
  shadow: null
@@ -2297,27 +2331,27 @@ function Cn() {
2297
2331
  for (; t.length > 0;) {
2298
2332
  let e = t.pop();
2299
2333
  if (e.shadow) {
2300
- Fn(e.shadow);
2334
+ Xn(e.shadow);
2301
2335
  continue;
2302
2336
  }
2303
- let n = e.node, r = b(n) === X.element, i = g(n);
2337
+ let n = e.node, r = v(n) === X.element, i = te(n);
2304
2338
  if (i) for (let e = i.length - 1; e >= 0; --e) t.push({
2305
2339
  node: i[e],
2306
2340
  shadow: null
2307
2341
  });
2308
2342
  if (r) {
2309
- let e = ne ? ne(n) : null;
2310
- if (typeof e == "string" && L(e) === "template") {
2343
+ let e = ie ? ie(n) : null;
2344
+ if (typeof e == "string" && R(e) === "template") {
2311
2345
  let e = n.content;
2312
- Bt(e) && t.push({
2346
+ Q(e) && t.push({
2313
2347
  node: e,
2314
2348
  shadow: null
2315
2349
  });
2316
2350
  }
2317
2351
  }
2318
2352
  if (r) {
2319
- let e = v(n);
2320
- Bt(e) && t.push({
2353
+ let e = g(n);
2354
+ Q(e) && t.push({
2321
2355
  node: null,
2322
2356
  shadow: e
2323
2357
  }, {
@@ -2329,81 +2363,84 @@ function Cn() {
2329
2363
  };
2330
2364
  return t.sanitize = function(e) {
2331
2365
  let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, a = null, o = null, s = null;
2332
- if (et = !e, et && (e = "<!-->"), typeof e != "string" && !Vt(e) && (e = Ht(e), typeof e != "string")) throw G("dirty is not a string, aborting");
2366
+ if (nt = !e, nt && (e = "<!-->"), typeof e != "string" && !In(e) && (e = Kt(e), typeof e != "string")) throw G("dirty is not a string, aborting");
2333
2367
  if (!t.isSupported) return e;
2334
- Ie ? (w = Le, T = Re) : lt(n), (C.uponSanitizeElement.length > 0 || C.uponSanitizeAttribute.length > 0) && (w = J(w)), C.uponSanitizeAttribute.length > 0 && (T = J(T)), t.removed = [];
2335
- let c = qe && typeof e != "string" && Vt(e);
2368
+ Le ? (w = Re, T = ze) : ft(n), (C.uponSanitizeElement.length > 0 || C.uponSanitizeAttribute.length > 0) && (w = J(w)), C.uponSanitizeAttribute.length > 0 && (T = J(T)), t.removed = [];
2369
+ let c = qe && typeof e != "string" && In(e), l = [], u = j;
2336
2370
  if (c) {
2337
- It(e);
2338
- let t = re(e);
2371
+ kn(e);
2372
+ let t = ae(e);
2339
2373
  if (typeof t == "string") {
2340
- let n = L(t);
2341
- if (!w[n] || Oe[n]) throw vt(e), G("root node is forbidden and cannot be sanitized in-place");
2342
- }
2343
- if (K(e)) throw vt(e), G("root node is clobbered and cannot be sanitized in-place");
2344
- try {
2345
- In(e);
2346
- } catch (t) {
2347
- throw vt(e), t;
2374
+ let n = R(t);
2375
+ if (!w[n] || Ae[n]) throw St(e), G("root node is forbidden and cannot be sanitized in-place");
2348
2376
  }
2349
- } else if (Vt(e)) i = Lt("<!---->"), a = i.ownerDocument.importNode(e, !0), a.nodeType === X.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? i = a : i.appendChild(a), In(i);
2377
+ if (Fn(e)) throw St(e), G("root node is clobbered and cannot be sanitized in-place");
2378
+ l = Ht(e), j = At();
2379
+ } else if (In(e)) i = An("<!---->"), a = i.ownerDocument.importNode(e, !0), a.nodeType === X.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? i = a : i.appendChild(a), Zn(i);
2350
2380
  else {
2351
- if (!Be && !O && !Fe && e.indexOf("<") === -1) return x && He ? le(e) : e;
2352
- if (i = Lt(e), !i) return Be ? null : He ? ie : "";
2381
+ if (!A && !O && !k && e.indexOf("<") === -1) return y && He ? fe(e) : e;
2382
+ if (i = An(e), !i) return A ? null : He ? b : "";
2353
2383
  }
2354
- i && ze && z(i.firstChild);
2355
- let l = c ? e : i;
2384
+ i && Be && z(i.firstChild);
2385
+ let d = c ? e : i;
2356
2386
  try {
2357
- let e = Rt(l);
2358
- for (; o = e.nextNode();) On(o, l), Pn(o, l), Bt(o.content) && Fn(o.content);
2359
- } catch (n) {
2360
- throw c && (vt(e), wt(t.removed, (e) => {
2361
- e.element && St(e.element);
2362
- })), n;
2387
+ c && Zn(e);
2388
+ let t = jn(d);
2389
+ for (; o = t.nextNode();) Hn(o, d), Yn(o, d), Q(o.content) && Xn(o.content);
2390
+ c && Wt(e, l);
2391
+ } catch (t) {
2392
+ throw c && (St(e), K(e, l)), t;
2393
+ } finally {
2394
+ j = u;
2363
2395
  }
2364
2396
  if (c) {
2365
- let n = !1;
2366
- if (wt(t.removed, (t) => {
2367
- t.element && (t.element === e && (n = !0), St(t.element));
2368
- }), n) throw G("a node selected for removal could not be safely returned; refusing to sanitize in place");
2369
- return O && U(e), e;
2370
- }
2371
- if (Be) {
2372
- if (O && U(i), Ve) for (s = me.call(i.ownerDocument); i.firstChild;) s.appendChild(i.firstChild);
2397
+ if (K(e, l)) throw G("a node selected for removal could not be safely returned; refusing to sanitize in place");
2398
+ return O && Nn(e), e;
2399
+ }
2400
+ if (A) {
2401
+ if (O && Nn(i), Ve) for (s = ge.call(i.ownerDocument); i.firstChild;) s.appendChild(i.firstChild);
2373
2402
  else s = i;
2374
- return (T.shadowroot || T.shadowrootmode) && (s = ge.call(r, s, !0)), s;
2403
+ return (T.shadowroot || T.shadowrootmode) && (s = ve.call(r, s, !0)), s;
2375
2404
  }
2376
- let u = Fe ? i.outerHTML : i.innerHTML;
2377
- return Fe && w["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && W(un, i.ownerDocument.doctype.name) && (u = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + u), O && (u = zt(u)), x && He ? le(u) : u;
2405
+ let f = k ? i.outerHTML : i.innerHTML;
2406
+ return k && w["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && W(hn, i.ownerDocument.doctype.name) && (f = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + f), O && (f = Mn(f)), y && He ? fe(f) : f;
2378
2407
  }, t.setConfig = function() {
2379
2408
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2380
- lt(e), Ie = !0, Le = w, Re = T;
2409
+ ft(e), Le = !0, Re = w, ze = T;
2381
2410
  }, t.clearConfig = function() {
2382
- R = null, Ie = !1, Le = null, Re = null, x = ae, ie = "";
2411
+ lt = null, Le = !1, Re = null, ze = null, y = ce, b = "";
2383
2412
  }, t.isValidAttribute = function(e, t, n) {
2384
- R || lt({});
2385
- let r = L(e), i = L(t);
2386
- return kn(r, i, n);
2413
+ lt || ft({});
2414
+ let r = R(e), i = R(t);
2415
+ return typeof n == "string" && (Jn(t, n) || !Fe && W(bn, n)) ? !1 : Un(r, i, n);
2387
2416
  }, t.addHook = function(e, t) {
2388
- typeof t == "function" && H(C, e) && Dt(C[e], t);
2417
+ typeof t == "function" && U(C, e) && Et(C[e], t);
2389
2418
  }, t.removeHook = function(e, t) {
2390
- if (H(C, e)) {
2419
+ if (U(C, e)) {
2391
2420
  if (t !== void 0) {
2392
- let n = Tt(C[e], t);
2421
+ let n = wt(C[e], t);
2393
2422
  return n === -1 ? void 0 : Ot(C[e], n, 1)[0];
2394
2423
  }
2395
- return Et(C[e]);
2424
+ return Tt(C[e]);
2396
2425
  }
2397
2426
  }, t.removeHooks = function(e) {
2398
- H(C, e) && (C[e] = []);
2427
+ U(C, e) && (C[e] = []);
2399
2428
  }, t.removeAllHooks = function() {
2400
- C = bn();
2429
+ C = wn();
2401
2430
  }, t;
2402
2431
  }
2403
- var wn = Cn(), Q = class {
2432
+ var On = Dn(), Z = class {
2404
2433
  constructor(e, t) {
2405
2434
  this.editor = e, this.defaultText = `${t} text`, this.button = this.createButton(), this.title = t;
2406
2435
  }
2436
+ trimSelection() {
2437
+ let e = this.editor.usertextarea, { selectionStart: t, selectionEnd: n, value: r } = e;
2438
+ if (t === n) return;
2439
+ let i = t, a = n;
2440
+ for (; i < a && /\s/.test(r[i]);) i++;
2441
+ for (; a > i && /\s/.test(r[a - 1]);) a--;
2442
+ i !== a && (i !== t || a !== n) && e.setSelectionRange(i, a);
2443
+ }
2407
2444
  createButton(e) {
2408
2445
  let t = document.createElement("button"), n = this.title ? `${this.title.replace(/ /g, "-")}-btn`.toLowerCase() : "";
2409
2446
  t.innerHTML = e;
@@ -2414,11 +2451,12 @@ var wn = Cn(), Q = class {
2414
2451
  }
2415
2452
  return t;
2416
2453
  }
2417
- }, Tn = class extends Q {
2454
+ }, kn = class extends Z {
2418
2455
  constructor(e) {
2419
2456
  super(e, "Bold"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M7 5h6a3.5 3.5 0 0 1 0 7h-6l0 -7\" /><path d=\"M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7\" /></svg>\n ");
2420
2457
  }
2421
2458
  applySyntax() {
2459
+ this.trimSelection();
2422
2460
  let e = this.editor.usertextarea, { selectionStart: t, selectionEnd: n } = e, r = e.value, i = r.substring(t, n), a = "", o = 0;
2423
2461
  if (i.startsWith("***") && i.endsWith("***")) a = "*" + i.slice(3, -3) + "*";
2424
2462
  else if (i.startsWith("**") && i.endsWith("**")) a = i.slice(2, -2);
@@ -2431,11 +2469,12 @@ var wn = Cn(), Q = class {
2431
2469
  } else a = `**${i || "Bold text"}**`, i || (o = 2);
2432
2470
  this.editor.insertText(a, o, o);
2433
2471
  }
2434
- }, En = class extends Q {
2472
+ }, An = class extends Z {
2435
2473
  constructor(e) {
2436
2474
  super(e, "Italic"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M11 5l6 0\" /><path d=\"M7 19l6 0\" /><path d=\"M14 5l-4 14\" /></svg>\n ");
2437
2475
  }
2438
2476
  applySyntax() {
2477
+ this.trimSelection();
2439
2478
  let e = this.editor.usertextarea, { selectionStart: t, selectionEnd: n } = e, r = e.value, i = r.substring(t, n), a = "", o = 0;
2440
2479
  if (i.startsWith("***") && i.endsWith("***")) a = "**" + i.slice(3, -3) + "**";
2441
2480
  else if (i.startsWith("*") && i.endsWith("*") && !i.startsWith("**")) a = i.slice(1, -1);
@@ -2448,11 +2487,12 @@ var wn = Cn(), Q = class {
2448
2487
  } else a = `*${i || "Italic text"}*`, i || (o = 1);
2449
2488
  this.editor.insertText(a, o, o);
2450
2489
  }
2451
- }, Dn = class extends Q {
2490
+ }, jn = class extends Z {
2452
2491
  constructor(e) {
2453
2492
  super(e, "Strikethrough"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M5 12l14 0\" /><path d=\"M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5\" /></svg>\n ");
2454
2493
  }
2455
2494
  applySyntax() {
2495
+ this.trimSelection();
2456
2496
  let e = this.editor.usertextarea, { selectionStart: t, selectionEnd: n } = e, r = e.value, i = r.substring(t, n), a = "", o = 0;
2457
2497
  if (i.startsWith("~~") && i.endsWith("~~")) a = i.slice(2, -2);
2458
2498
  else if (r.substring(t - 2, t) === "~~" && r.substring(n, n + 2) === "~~") {
@@ -2461,7 +2501,7 @@ var wn = Cn(), Q = class {
2461
2501
  } else a = `~~${i || "Strikethrough text"}~~`, o = 2;
2462
2502
  this.editor.insertText(a, o, o);
2463
2503
  }
2464
- }, On = class extends Q {
2504
+ }, Mn = class extends Z {
2465
2505
  constructor(e) {
2466
2506
  super(e, "Unordered list"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M9 6l11 0\" /><path d=\"M9 12l11 0\" /><path d=\"M9 18l11 0\" /><path d=\"M5 6l0 .01\" /><path d=\"M5 12l0 .01\" /><path d=\"M5 18l0 .01\" /></svg>\n ");
2467
2507
  }
@@ -2474,7 +2514,7 @@ var wn = Cn(), Q = class {
2474
2514
  } else a = `- ${i || "Unordered list"}`, o = 2;
2475
2515
  this.editor.insertText(a, o);
2476
2516
  }
2477
- }, kn = class extends Q {
2517
+ }, Nn = class extends Z {
2478
2518
  constructor(e) {
2479
2519
  super(e, "Ordered list"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M11 6h9\" /><path d=\"M11 12h9\" /><path d=\"M12 18h8\" /><path d=\"M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4\" /><path d=\"M6 10v-6l-2 2\" /></svg>\n ");
2480
2520
  }
@@ -2487,7 +2527,7 @@ var wn = Cn(), Q = class {
2487
2527
  } else a = `1. ${i || "Ordered list"}`, o = 3;
2488
2528
  this.editor.insertText(a, o);
2489
2529
  }
2490
- }, An = class extends Q {
2530
+ }, Pn = class extends Z {
2491
2531
  constructor(e) {
2492
2532
  super(e, "Preview"), this.preview = !0, this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M12 4v16\" /><path d=\"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14\" /><path d=\"M12 13l7.5 -7.5\" /><path d=\"M12 18l8 -8\" /><path d=\"M15 20l5 -5\" /><path d=\"M12 8l4 -4\" /></svg>\n ");
2493
2533
  let t = this.button.querySelector("button");
@@ -2518,7 +2558,7 @@ var wn = Cn(), Q = class {
2518
2558
  destroy() {
2519
2559
  this.preview || (document.removeEventListener("keydown", this._escHandler), document.querySelector("body")?.classList.remove("fj:overflow-hidden"));
2520
2560
  }
2521
- }, jn = class extends Q {
2561
+ }, Fn = class extends Z {
2522
2562
  constructor(e) {
2523
2563
  super(e, "Check list"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M3.5 5.5l1.5 1.5l2.5 -2.5\" /><path d=\"M3.5 11.5l1.5 1.5l2.5 -2.5\" /><path d=\"M3.5 17.5l1.5 1.5l2.5 -2.5\" /><path d=\"M11 6l9 0\" /><path d=\"M11 12l9 0\" /><path d=\"M11 18l9 0\" /></svg>\n ");
2524
2564
  }
@@ -2535,7 +2575,7 @@ var wn = Cn(), Q = class {
2535
2575
  }
2536
2576
  this.editor.insertText(s, c);
2537
2577
  }
2538
- }, Mn = class extends Q {
2578
+ }, Q = class extends Z {
2539
2579
  constructor(e) {
2540
2580
  super(e, "Blockquote"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M10 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5\" /><path d=\"M19 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5\" /></svg>\n ");
2541
2581
  }
@@ -2551,7 +2591,7 @@ var wn = Cn(), Q = class {
2551
2591
  };
2552
2592
  //#endregion
2553
2593
  //#region src/components/modal.js
2554
- function Nn(e, t, n, r = "") {
2594
+ function In(e, t, n, r = "") {
2555
2595
  let i = e.target.closest(".markdown-editor-wrapper");
2556
2596
  i.querySelector(".markdown-modal") && i.querySelector(".markdown-modal").remove();
2557
2597
  let a = `
@@ -2567,17 +2607,18 @@ function Nn(e, t, n, r = "") {
2567
2607
  }
2568
2608
  //#endregion
2569
2609
  //#region src/components/toolbar/tools/LinkTool.js
2570
- var Pn = class extends Q {
2610
+ var $ = class extends Z {
2571
2611
  constructor(e) {
2572
2612
  super(e, "Link"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M9 15l6 -6\" /><path d=\"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464\" /><path d=\"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463\" /></svg>\n ");
2573
2613
  }
2574
2614
  applySyntax(e) {
2615
+ this.trimSelection();
2575
2616
  let t = this.editor, n = t.usertextarea, { selectionStart: r, selectionEnd: i } = n, a = n.value, o = a.substring(0, r), s = a.substring(i);
2576
2617
  if (o.endsWith("[") && /^\]\([^)]+\)/.test(s)) {
2577
2618
  let e = s.match(/^\]\(([^)]+)\)/);
2578
2619
  e && (r = o.length - 1, i += e[0].length, n.setSelectionRange(r, i));
2579
2620
  }
2580
- let c = a.substring(r, i), l = c && c.match(/^\[([^\]]+)\]\(([^)]+)\)$/), u = l ? l[1] : c, d = l ? l[2] : "", f = Nn(e, "fj:max-w-sm", `
2621
+ let c = a.substring(r, i), l = c && c.match(/^\[([^\]]+)\]\(([^)]+)\)$/), u = l ? l[1] : c, d = l ? l[2] : "", f = In(e, "fj:max-w-sm", `
2581
2622
  <div class="fj:flex fj:justify-between fj:items-center fj:gap-3">
2582
2623
  <div class="fj:font-medium">${this.editor.label("Link")}</div>
2583
2624
  <button type="button" class="modal-close-btn fj:me-btn fj:me-btn-ghost fj:me-btn-xs fj:me-btn-circle" aria-label="${this.editor.label("Close")}">
@@ -2602,7 +2643,7 @@ var Pn = class extends Q {
2602
2643
  }
2603
2644
  });
2604
2645
  }
2605
- }, Fn = class extends Q {
2646
+ }, Ln = class extends Z {
2606
2647
  constructor(e) {
2607
2648
  super(e, "Heading"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M7 12h10\" /><path d=\"M7 5v14\" /><path d=\"M17 5v14\" /><path d=\"M15 19h4\" /><path d=\"M15 5h4\" /><path d=\"M5 19h4\" /><path d=\"M5 5h4\" /></svg>\n ");
2608
2649
  }
@@ -2636,16 +2677,16 @@ var Pn = class extends Q {
2636
2677
  return s.className = "fj:me-popover", s.appendChild(n), s.appendChild(i), s;
2637
2678
  }
2638
2679
  applyHeading(e) {
2639
- let t = this.editor.usertextarea, { selectionStart: n, selectionEnd: r } = t, i = t.value, a = i.lastIndexOf("\n", n - 1) + 1, o = i.indexOf("\n", r), s = o === -1 ? i.length : o, c = i.substring(a, s), l = (c.match(/^(#+)\s/) || [])[1], u = c.replace(/^#+\s*/, ""), d = `${"#".repeat(e)} `, f = l && l.length === e ? u || "Heading" : u ? `${d}${u}` : `${d}Heading`;
2680
+ let t = this.editor.usertextarea, { selectionStart: n, selectionEnd: r } = t, i = t.value, a = i.lastIndexOf("\n", n - 1) + 1, o = i.indexOf("\n", r), s = o === -1 ? i.length : o, c = i.substring(a, s), l = (c.match(/^(#+)\s/) || [])[1], u = c.replace(/^#+\s*/, ""), d = `${"#".repeat(e)} `, f = l && l.length === e ? u || "Heading" : u ? `${d}${u}` : `${d}Heading`, p = t.scrollTop;
2640
2681
  t.value = `${i.substring(0, a)}${f}${i.substring(s)}`, t.focus();
2641
- let p = a + (f === u || f === "Heading" ? 0 : d.length), m = a + f.length;
2642
- t.setSelectionRange(p, m), this.editor.scrollToView(), this.editor.render(), this.editor.notifyChange();
2682
+ let m = a + (f === u || f === "Heading" ? 0 : d.length), ee = a + f.length;
2683
+ t.setSelectionRange(m, ee), this.editor.render(), this.editor.notifyChange(), this.editor.restoreScroll(p);
2643
2684
  }
2644
2685
  applySyntax() {}
2645
2686
  };
2646
2687
  //#endregion
2647
2688
  //#region src/utils/imageUpload.js
2648
- async function In(e, { uploadUrl: t, params: n = {}, alt: r = "" } = {}) {
2689
+ async function Rn(e, { uploadUrl: t, params: n = {}, alt: r = "" } = {}) {
2649
2690
  let i = new FormData();
2650
2691
  i.append("image_file", e), i.append("image_alt", r);
2651
2692
  for (let [e, t] of Object.entries(n)) i.append(e, t);
@@ -2663,7 +2704,7 @@ async function In(e, { uploadUrl: t, params: n = {}, alt: r = "" } = {}) {
2663
2704
  }
2664
2705
  //#endregion
2665
2706
  //#region src/components/toolbar/tools/ImageTool.js
2666
- var Ln = class extends Q {
2707
+ var zn = class extends Z {
2667
2708
  constructor(e, t = {}) {
2668
2709
  super(e, "Image link"), this.config = t, this.fileInputConfig = t.fileInput || !1, this.altInputConfig = t.altInput === void 0 ? { required: !0 } : t.altInput, this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M15 8h.01\" /><path d=\"M12.5 21h-6.5a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v6.5\" /><path d=\"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l4 4\" /><path d=\"M14 14l1 -1c.67 -.644 1.45 -.824 2.182 -.54\" /><path d=\"M16 19h6\" /><path d=\"M19 16v6\" /></svg>\n ");
2669
2710
  }
@@ -2673,12 +2714,12 @@ var Ln = class extends Q {
2673
2714
  let e = s.match(/^\]\(([^)]+)\)/);
2674
2715
  e && (r = o.length - 2, i += e[0].length, n.setSelectionRange(r, i));
2675
2716
  }
2676
- let c = a.substring(r, i), l = this.fileInputConfig.accept ? this.fileInputConfig.accept.map((e) => `image/${e}`).join(",") : "image/*", u = typeof this.altInputConfig == "boolean" ? this.altInputConfig : this.altInputConfig.required !== !1, d = this.fileInputConfig.uploadUrl || null, f = this.fileInputConfig.params || {}, p = c && c.match(/^!\[([^\]]*)\]\(([^)]+)\)$/), m = p ? p[1] : c, h = p ? p[2] : "", g = "";
2677
- this.fileInputConfig && (g = `
2717
+ let c = a.substring(r, i), l = this.fileInputConfig.accept ? this.fileInputConfig.accept.map((e) => `image/${e}`).join(",") : "image/*", u = typeof this.altInputConfig == "boolean" ? this.altInputConfig : this.altInputConfig.required !== !1, d = this.fileInputConfig.uploadUrl || null, f = this.fileInputConfig.params || {}, p = c && c.match(/^!\[([^\]]*)\]\(([^)]+)\)$/), m = p ? p[1] : c, ee = p ? p[2] : "", te = "";
2718
+ this.fileInputConfig && (te = `
2678
2719
  <input type="file" accept="${l}" class="img-file-input fj:me-input fj:w-full">
2679
2720
  <div class="fj:me-divider fj:my-1">OR</div>
2680
2721
  `);
2681
- let _ = Nn(e, "fj:max-w-sm", `
2722
+ let h = In(e, "fj:max-w-sm", `
2682
2723
  <div class="fj:flex fj:justify-between fj:items-center fj:gap-3">
2683
2724
  <div class="fj:font-medium">${t.label("Image")}</div>
2684
2725
  <button type="button" class="modal-close-btn fj:me-btn fj:me-btn-ghost fj:me-btn-xs fj:me-btn-circle" aria-label="${t.label("Close")}">
@@ -2686,16 +2727,16 @@ var Ln = class extends Q {
2686
2727
  </button>
2687
2728
  </div>
2688
2729
  <div class="fj:mt-4 fj:flex fj:flex-col fj:gap-y-4">
2689
- ${g}
2690
- <input type="url" placeholder="${t.label("URL")}" class="img-link-input fj:me-input fj:w-full" value="${h}" required>
2730
+ ${te}
2731
+ <input type="url" placeholder="${t.label("URL")}" class="img-link-input fj:me-input fj:w-full" value="${ee}" required>
2691
2732
  <input type="text" placeholder="${t.label("Alt text")}" class="img-link-alt-input fj:me-input fj:w-full" value="${m}" ${u ? "required" : ""}>
2692
2733
  <button type="button" class="submit-img-link fj:me-btn fj:me-btn-sm fj:self-end">${t.label("Apply")}</button>
2693
2734
  </div>`, "Image");
2694
- _.querySelector(".modal-close-btn").addEventListener("click", () => _.close());
2695
- let v = _.querySelector(".submit-img-link");
2696
- v.addEventListener("click", async (e) => {
2735
+ h.querySelector(".modal-close-btn").addEventListener("click", () => h.close());
2736
+ let g = h.querySelector(".submit-img-link");
2737
+ g.addEventListener("click", async (e) => {
2697
2738
  e.preventDefault();
2698
- let n = _.querySelector(".img-file-input"), r = _.querySelector(".img-link-input"), i = _.querySelector(".img-link-alt-input"), a = n?.files[0];
2739
+ let n = h.querySelector(".img-file-input"), r = h.querySelector(".img-link-input"), i = h.querySelector(".img-link-alt-input"), a = n?.files[0];
2699
2740
  if (a && (r.required = !1), u && !i.validity.valid) {
2700
2741
  i.reportValidity(), a && (r.required = !0);
2701
2742
  return;
@@ -2706,25 +2747,25 @@ var Ln = class extends Q {
2706
2747
  }
2707
2748
  if (a && d) {
2708
2749
  let e = n.files[0];
2709
- v.disabled = !0, v.textContent = t.label("Uploading...");
2750
+ g.disabled = !0, g.textContent = t.label("Uploading...");
2710
2751
  try {
2711
- let { path: t, alt: n } = await In(e, {
2752
+ let { path: t, alt: n } = await Rn(e, {
2712
2753
  uploadUrl: d,
2713
2754
  params: f,
2714
2755
  alt: i.value
2715
2756
  });
2716
2757
  r.value = t, n && !i.value.trim() && (i.value = n);
2717
2758
  } catch (e) {
2718
- alert(e.message || "Upload failed."), v.disabled = !1, v.textContent = t.label("Apply"), r.required = !0;
2759
+ alert(e.message || "Upload failed."), g.disabled = !1, g.textContent = t.label("Apply"), r.required = !0;
2719
2760
  return;
2720
2761
  }
2721
- v.disabled = !1, v.textContent = t.label("Apply");
2762
+ g.disabled = !1, g.textContent = t.label("Apply");
2722
2763
  }
2723
2764
  let o = r.value, s = `![${i.value || ""}](${o})`;
2724
- t.insertText(s), _.close();
2765
+ t.insertText(s), h.close();
2725
2766
  });
2726
2767
  }
2727
- }, Rn = class extends Q {
2768
+ }, Bn = class extends Z {
2728
2769
  constructor(e) {
2729
2770
  super(e, "Undo"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M9 14l-4 -4l4 -4\" /><path d=\"M5 10h11a4 4 0 1 1 0 8h-1\" /></svg>\n ");
2730
2771
  }
@@ -2732,7 +2773,7 @@ var Ln = class extends Q {
2732
2773
  let e = this.editor.undoRedoManager;
2733
2774
  e && e.undo();
2734
2775
  }
2735
- }, zn = class extends Q {
2776
+ }, Vn = class extends Z {
2736
2777
  constructor(e) {
2737
2778
  super(e, "Redo"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M15 14l4 -4l-4 -4\" /><path d=\"M19 10h-11a4 4 0 1 0 0 8h1\" /></svg>\n ");
2738
2779
  }
@@ -2740,7 +2781,7 @@ var Ln = class extends Q {
2740
2781
  let e = this.editor.undoRedoManager;
2741
2782
  e && e.redo();
2742
2783
  }
2743
- }, Bn = class extends Q {
2784
+ }, Hn = class extends Z {
2744
2785
  constructor(e) {
2745
2786
  super(e, "Indent"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M20 6l-11 0\" /><path d=\"M20 12l-7 0\" /><path d=\"M20 18l-11 0\" /><path d=\"M4 8l4 4l-4 4\" /></svg>\n ");
2746
2787
  }
@@ -2748,7 +2789,7 @@ var Ln = class extends Q {
2748
2789
  let e = this.editor.indentManager;
2749
2790
  e && (e.indent(), this.editor.render());
2750
2791
  }
2751
- }, Vn = class extends Q {
2792
+ }, Un = class extends Z {
2752
2793
  constructor(e) {
2753
2794
  super(e, "Outdent"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M20 6l-7 0\" /><path d=\"M20 12l-9 0\" /><path d=\"M20 18l-7 0\" /><path d=\"M8 8l-4 4l4 4\" /></svg>\n ");
2754
2795
  }
@@ -2756,11 +2797,12 @@ var Ln = class extends Q {
2756
2797
  let t = this.editor.indentManager;
2757
2798
  t && (t.outdent(), this.editor.render());
2758
2799
  }
2759
- }, Hn = class extends Q {
2800
+ }, Wn = class extends Z {
2760
2801
  constructor(e) {
2761
2802
  super(e, "Code"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M7 8l-4 4l4 4\" /><path d=\"M17 8l4 4l-4 4\" /><path d=\"M14 4l-4 16\" /></svg>\n ");
2762
2803
  }
2763
2804
  applySyntax() {
2805
+ this.trimSelection();
2764
2806
  let e = this.editor.usertextarea, { selectionStart: t, selectionEnd: n } = e, r = e.value, i = r.substring(t, n);
2765
2807
  if (i.startsWith("`") && i.endsWith("`")) {
2766
2808
  this.editor.insertText(i.slice(1, -1), 0, 0);
@@ -2773,7 +2815,7 @@ var Ln = class extends Q {
2773
2815
  let a = `\`${i || "code"}\``;
2774
2816
  this.editor.insertText(a, 1, 1);
2775
2817
  }
2776
- }, Un = class extends Q {
2818
+ }, Gn = class extends Z {
2777
2819
  constructor(e) {
2778
2820
  super(e, "Code Block"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M8 9l3 3l-3 3\" /><path d=\"M13 15l3 0\" /><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\" /></svg>\n ");
2779
2821
  }
@@ -2787,7 +2829,7 @@ var Ln = class extends Q {
2787
2829
  let i = `\`\`\`\n${r || "code"}\n\`\`\``;
2788
2830
  this.editor.insertText(i, 4, 4);
2789
2831
  }
2790
- }, Wn = class extends Q {
2832
+ }, Kn = class extends Z {
2791
2833
  constructor(e) {
2792
2834
  super(e, "Horizontal Rule"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M4 12l16 0\" stroke-width=\"3\"/><path d=\"M4 7l6 0\" /><path d=\"M4 17l6 0\" /><path d=\"M14 7l6 0\" /><path d=\"M14 17l6 0\" /></svg>\n ");
2793
2835
  }
@@ -2795,7 +2837,7 @@ var Ln = class extends Q {
2795
2837
  let e = this.editor.usertextarea, { selectionStart: t } = e, n = e.value, r = t === 0 || n[t - 1] === "\n" ? "---\n" : "\n\n---\n";
2796
2838
  this.editor.insertText(r, r.length, 0);
2797
2839
  }
2798
- }, Gn = class extends Q {
2840
+ }, qn = class extends Z {
2799
2841
  constructor(e) {
2800
2842
  super(e, "Table"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z\" /><path d=\"M3 10h18\" /><path d=\"M10 3v18\" /></svg>\n ");
2801
2843
  }
@@ -2806,26 +2848,26 @@ var Ln = class extends Q {
2806
2848
  };
2807
2849
  //#endregion
2808
2850
  //#region src/utils/variables.js
2809
- function Kn(e) {
2851
+ function Jn(e) {
2810
2852
  let t = (e) => e && e.label && typeof e.value == "string", n = [];
2811
2853
  for (let r of Array.isArray(e) ? e : []) r && (Array.isArray(r.items) ? n.push(...r.items.filter(t)) : t(r) && n.push(r));
2812
2854
  return n;
2813
2855
  }
2814
- function qn(e, t) {
2815
- let n = Kn(t).filter((e) => typeof e.sample == "string");
2856
+ function Yn(e, t) {
2857
+ let n = Jn(t).filter((e) => typeof e.sample == "string");
2816
2858
  return n.length ? n.slice().sort((e, t) => t.value.length - e.value.length).reduce((e, t) => e.split(t.value).join(t.sample), e) : e;
2817
2859
  }
2818
2860
  //#endregion
2819
2861
  //#region src/components/toolbar/tools/VariableTool.js
2820
- var Jn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M7 4a2 2 0 0 0 -2 2v3a2 2 0 0 1 -2 2a2 2 0 0 1 2 2v3a2 2 0 0 0 2 2\" /><path d=\"M17 4a2 2 0 0 1 2 2v3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2v3a2 2 0 0 1 -2 2\" /></svg>\n", Yn = class extends Q {
2862
+ var Xn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M7 4a2 2 0 0 0 -2 2v3a2 2 0 0 1 -2 2a2 2 0 0 1 2 2v3a2 2 0 0 0 2 2\" /><path d=\"M17 4a2 2 0 0 1 2 2v3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2v3a2 2 0 0 1 -2 2\" /></svg>\n", Zn = class extends Z {
2821
2863
  constructor(e) {
2822
2864
  super(e, "Variables");
2823
2865
  }
2824
2866
  createButton() {
2825
2867
  let e = this.editor.variables ?? [];
2826
- if (!Kn(e).length) return null;
2868
+ if (!Jn(e).length) return null;
2827
2869
  let t = `variable-popover-${Math.random().toString(36).slice(2, 7)}`, n = document.createElement("button");
2828
- n.innerHTML = Jn, n.querySelector("svg")?.setAttribute("aria-hidden", "true"), n.type = "button", n.title = this.editor.label("Insert variable"), n.setAttribute("aria-label", this.editor.label("Insert variable")), n.setAttribute("aria-haspopup", "menu"), n.className = "markdown-btn variable-btn fj:me-btn fj:me-btn-xs fj:me-btn-square fj:me-btn-ghost fj:me-popover-toggle", n.setAttribute("popovertarget", t);
2870
+ n.innerHTML = Xn, n.querySelector("svg")?.setAttribute("aria-hidden", "true"), n.type = "button", n.title = this.editor.label("Insert variable"), n.setAttribute("aria-label", this.editor.label("Insert variable")), n.setAttribute("aria-haspopup", "menu"), n.className = "markdown-btn variable-btn fj:me-btn fj:me-btn-xs fj:me-btn-square fj:me-btn-ghost fj:me-popover-toggle", n.setAttribute("popovertarget", t);
2829
2871
  let r = document.createElement("div");
2830
2872
  r.id = t, r.setAttribute("role", "menu"), r.setAttribute("aria-label", this.editor.label("Variables")), r.className = "fj:me-popover-content", r.setAttribute("popover", "");
2831
2873
  let i = document.createElement("ul");
@@ -2856,14 +2898,14 @@ var Jn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
2856
2898
  }), n.appendChild(r), n;
2857
2899
  }
2858
2900
  applySyntax() {}
2859
- }, Xn = class extends Q {
2901
+ }, Qn = class extends Z {
2860
2902
  constructor(e, t = {}) {
2861
2903
  super(e, t.title || "Custom"), this.action = t.action, this.button = typeof this.action == "function" ? this.createButton(t.icon || "") : null, this.shortcut = this.button ? t.shortcut : void 0, this.button || console.warn("[MarkdownEditor] A custom tool needs an action function. Skipping it.", t);
2862
2904
  }
2863
2905
  applySyntax(e) {
2864
2906
  this.action(this.editor, e);
2865
2907
  }
2866
- }, Zn = class {
2908
+ }, $n = class {
2867
2909
  constructor(e, t, { standalone: n = !1 } = {}) {
2868
2910
  this.editor = e, this.options = t, this.standalone = n, this.tools = [], this.toolbar = document.createElement("div"), this.toolbar.className = n ? "toolbar not-prose fj:flex fj:items-center fj:gap-x-1" : "toolbar not-prose fj:me-surface fj:me-surface-outline fj:border-base-soft fj:border-0 fj:border-b fj:flex fj:items-center fj:gap-x-1 fj:p-1.5 fj:overflow-x-auto", this.toolbar.setAttribute("role", "toolbar"), this.toolbar.setAttribute("aria-label", e.label("Editor toolbar")), this.init();
2869
2911
  }
@@ -2872,32 +2914,32 @@ var Jn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
2872
2914
  }
2873
2915
  init() {
2874
2916
  let e = {
2875
- heading: Fn,
2876
- ul: On,
2877
- ol: kn,
2878
- checklist: jn,
2879
- bold: Tn,
2880
- italic: En,
2881
- strikethrough: Dn,
2882
- blockquote: Mn,
2883
- code: Hn,
2884
- codeblock: Un,
2885
- hr: Wn,
2886
- table: Gn,
2887
- link: Pn,
2888
- image: Ln,
2889
- undo: Rn,
2890
- redo: zn,
2891
- indent: Bn,
2892
- outdent: Vn,
2893
- variables: Yn
2917
+ heading: Ln,
2918
+ ul: Mn,
2919
+ ol: Nn,
2920
+ checklist: Fn,
2921
+ bold: kn,
2922
+ italic: An,
2923
+ strikethrough: jn,
2924
+ blockquote: Q,
2925
+ code: Wn,
2926
+ codeblock: Gn,
2927
+ hr: Kn,
2928
+ table: qn,
2929
+ link: $,
2930
+ image: zn,
2931
+ undo: Bn,
2932
+ redo: Vn,
2933
+ indent: Hn,
2934
+ outdent: Un,
2935
+ variables: Zn
2894
2936
  };
2895
2937
  if (this.options.forEach((t) => {
2896
2938
  let n, r;
2897
2939
  if (typeof t == "string") n = e[t];
2898
2940
  else if (typeof t == "function") n = t;
2899
2941
  else if (t && typeof t.tool == "function") n = t.tool, r = t.config;
2900
- else if (t && t.custom) n = Xn, r = t.custom;
2942
+ else if (t && t.custom) n = Qn, r = t.custom;
2901
2943
  else if (typeof t == "object") {
2902
2944
  let i = Object.keys(t)[0];
2903
2945
  r = t[i], n = e[i];
@@ -2908,20 +2950,20 @@ var Jn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
2908
2950
  }
2909
2951
  }), !this.standalone) {
2910
2952
  if (this.options.includes("preview")) {
2911
- let e = new An(this.editor);
2953
+ let e = new Pn(this.editor);
2912
2954
  this.editor.previewTool = e, this.toolbar.appendChild(e.button);
2913
2955
  }
2914
2956
  this.editor.editorContainer.insertBefore(this.toolbar, this.editor.markdownEditorDiv);
2915
2957
  }
2916
2958
  }
2917
- }, Qn = class {
2959
+ }, er = class {
2918
2960
  constructor(e) {
2919
2961
  this.previewContainer = document.createElement("div"), this.previewContainer.className = "preview-wrapper fj:p-2 fj:hidden fj:me-surface fj:me-surface-outline fj:border-base-soft fj:border-0 fj:border-l", this.previewContainer.setAttribute("role", "region"), this.previewContainer.setAttribute("aria-label", "Preview"), this.previewContent = document.createElement("div"), this.previewContent.className = "preview-content fj:mte-prose fj:mte-prose-sm fj:md:mte-prose-base fj:me-prose-frutjam fj:p-1.5 fj:overflow-y-auto fj:h-full fj:max-w-full", this.previewContainer.appendChild(this.previewContent), e.appendChild(this.previewContainer);
2920
2962
  }
2921
2963
  getPreviewContent() {
2922
2964
  return this.previewContent;
2923
2965
  }
2924
- }, $n = class {
2966
+ }, tr = class {
2925
2967
  constructor(e, t = {}) {
2926
2968
  this.options = t, this.footer = document.createElement("div"), this.footer.className = "editor-footer not-prose fj:me-surface fj:me-surface-outline fj:border-base-soft fj:border-0 fj:border-t fj:flex fj:justify-between fj:items-center fj:px-3 fj:py-1 fj:text-xs fj:opacity-60 fj:select-none", this.footer.setAttribute("aria-hidden", "true"), this.positionEl = document.createElement("span"), this.charsEl = document.createElement("span"), this.wordsEl = document.createElement("span"), (this.options.line || this.options.col) && this.footer.appendChild(this.positionEl), this.options.chars && this.footer.appendChild(this.charsEl), this.options.words && this.footer.appendChild(this.wordsEl), e.appendChild(this.footer);
2927
2969
  }
@@ -2936,7 +2978,7 @@ var Jn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
2936
2978
  this.wordsEl.textContent = `${e.toLocaleString()} words`;
2937
2979
  }
2938
2980
  }
2939
- }, $ = class {
2981
+ }, nr = class {
2940
2982
  diff(e, t, n = {}) {
2941
2983
  let r;
2942
2984
  typeof n == "function" ? (r = n, n = {}) : "callback" in n && (r = n.callback);
@@ -2959,7 +3001,7 @@ var Jn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
2959
3001
  lastComponent: void 0
2960
3002
  }], f = this.extractCommon(d[0], t, e, 0, n);
2961
3003
  if (d[0].oldPos + 1 >= o && f + 1 >= a) return i(this.buildValues(d[0].lastComponent, t, e));
2962
- let p = -Infinity, m = Infinity, h = () => {
3004
+ let p = -Infinity, m = Infinity, ee = () => {
2963
3005
  for (let r = Math.max(p, -s); r <= Math.min(m, s); r += 2) {
2964
3006
  let s, c = d[r - 1], l = d[r + 1];
2965
3007
  c && (d[r - 1] = void 0);
@@ -2968,12 +3010,12 @@ var Jn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
2968
3010
  let e = l.oldPos - r;
2969
3011
  u = l && 0 <= e && e < a;
2970
3012
  }
2971
- let h = c && c.oldPos + 1 < o;
2972
- if (!u && !h) {
3013
+ let ee = c && c.oldPos + 1 < o;
3014
+ if (!u && !ee) {
2973
3015
  d[r] = void 0;
2974
3016
  continue;
2975
3017
  }
2976
- if (s = !h || u && c.oldPos < l.oldPos ? this.addToPath(l, !0, !1, 0, n) : this.addToPath(c, !1, !0, 1, n), f = this.extractCommon(s, t, e, r, n), s.oldPos + 1 >= o && f + 1 >= a) return i(this.buildValues(s.lastComponent, t, e)) || !0;
3018
+ if (s = !ee || u && c.oldPos < l.oldPos ? this.addToPath(l, !0, !1, 0, n) : this.addToPath(c, !1, !0, 1, n), f = this.extractCommon(s, t, e, r, n), s.oldPos + 1 >= o && f + 1 >= a) return i(this.buildValues(s.lastComponent, t, e)) || !0;
2977
3019
  d[r] = s, s.oldPos + 1 >= o && (m = Math.min(m, r - 1)), f + 1 >= a && (p = Math.max(p, r + 1));
2978
3020
  }
2979
3021
  s++;
@@ -2981,11 +3023,11 @@ var Jn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
2981
3023
  if (r) (function e() {
2982
3024
  setTimeout(function() {
2983
3025
  if (s > c || Date.now() > u) return r(void 0);
2984
- h() || e();
3026
+ ee() || e();
2985
3027
  }, 0);
2986
3028
  })();
2987
3029
  else for (; s <= c && Date.now() <= u;) {
2988
- let e = h();
3030
+ let e = ee();
2989
3031
  if (e) return e;
2990
3032
  }
2991
3033
  }
@@ -3068,42 +3110,42 @@ var Jn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
3068
3110
  }
3069
3111
  return r;
3070
3112
  }
3071
- }, er = new class extends $ {}();
3072
- function tr(e, t, n) {
3073
- return er.diff(e, t, n);
3113
+ }, rr = new class extends nr {}();
3114
+ function ir(e, t, n) {
3115
+ return rr.diff(e, t, n);
3074
3116
  }
3075
3117
  //#endregion
3076
3118
  //#region node_modules/diff/libesm/util/string.js
3077
- function nr(e, t) {
3119
+ function ar(e, t) {
3078
3120
  let n = 0;
3079
3121
  for (; n < e.length && n < t.length; n++) if (e[n] != t[n]) return e.slice(0, n);
3080
3122
  return e.slice(0, n);
3081
3123
  }
3082
- function rr(e, t) {
3124
+ function or(e, t) {
3083
3125
  let n;
3084
3126
  if (!e || !t || e[e.length - 1] != t[t.length - 1]) return "";
3085
3127
  for (n = 0; n < e.length && n < t.length; n++) if (e[e.length - (n + 1)] != t[t.length - (n + 1)]) return e.slice(-n);
3086
3128
  return e.slice(-n);
3087
3129
  }
3088
- function ir(e, t, n) {
3130
+ function sr(e, t, n) {
3089
3131
  if (e.slice(0, t.length) != t) throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);
3090
3132
  return n + e.slice(t.length);
3091
3133
  }
3092
- function ar(e, t, n) {
3134
+ function cr(e, t, n) {
3093
3135
  if (!t) return e + n;
3094
3136
  if (e.slice(-t.length) != t) throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);
3095
3137
  return e.slice(0, -t.length) + n;
3096
3138
  }
3097
- function or(e, t) {
3098
- return ir(e, t, "");
3139
+ function lr(e, t) {
3140
+ return sr(e, t, "");
3099
3141
  }
3100
- function sr(e, t) {
3101
- return ar(e, t, "");
3142
+ function ur(e, t) {
3143
+ return cr(e, t, "");
3102
3144
  }
3103
- function cr(e, t) {
3104
- return t.slice(0, lr(e, t));
3145
+ function dr(e, t) {
3146
+ return t.slice(0, fr(e, t));
3105
3147
  }
3106
- function lr(e, t) {
3148
+ function fr(e, t) {
3107
3149
  let n = 0;
3108
3150
  e.length > t.length && (n = e.length - t.length);
3109
3151
  let r = t.length;
@@ -3121,7 +3163,7 @@ function lr(e, t) {
3121
3163
  }
3122
3164
  return a;
3123
3165
  }
3124
- function ur(e, t) {
3166
+ function pr(e, t) {
3125
3167
  let n = [];
3126
3168
  for (let r of Array.from(t.segment(e))) {
3127
3169
  let e = r.segment;
@@ -3129,27 +3171,27 @@ function ur(e, t) {
3129
3171
  }
3130
3172
  return n;
3131
3173
  }
3132
- function dr(e, t) {
3133
- if (t) return pr(e, t)[1];
3174
+ function mr(e, t) {
3175
+ if (t) return gr(e, t)[1];
3134
3176
  let n;
3135
3177
  for (n = e.length - 1; n >= 0 && e[n].match(/\s/); n--);
3136
3178
  return e.substring(n + 1);
3137
3179
  }
3138
- function fr(e, t) {
3139
- if (t) return pr(e, t)[0];
3180
+ function hr(e, t) {
3181
+ if (t) return gr(e, t)[0];
3140
3182
  let n = e.match(/^\s*/);
3141
3183
  return n ? n[0] : "";
3142
3184
  }
3143
- function pr(e, t) {
3144
- if (!t) return [fr(e), dr(e)];
3185
+ function gr(e, t) {
3186
+ if (!t) return [hr(e), mr(e)];
3145
3187
  if (t.resolvedOptions().granularity != "word") throw Error("The segmenter passed must have a granularity of \"word\"");
3146
- let n = ur(e, t), r = n[0], i = n[n.length - 1];
3188
+ let n = pr(e, t), r = n[0], i = n[n.length - 1];
3147
3189
  return [/\s/.test(r) ? r : "", /\s/.test(i) ? i : ""];
3148
3190
  }
3149
3191
  //#endregion
3150
3192
  //#region node_modules/diff/libesm/diff/word.js
3151
- var mr = "a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}", hr = RegExp(`[${mr}]+|\\s+|[^${mr}]`, "ug");
3152
- new class extends $ {
3193
+ var _r = "a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}", vr = RegExp(`[${_r}]+|\\s+|[^${_r}]`, "ug");
3194
+ new class extends nr {
3153
3195
  equals(e, t, n) {
3154
3196
  return n.ignoreCase && (e = e.toLowerCase(), t = t.toLowerCase()), e.trim() === t.trim();
3155
3197
  }
@@ -3158,8 +3200,8 @@ new class extends $ {
3158
3200
  if (t.intlSegmenter) {
3159
3201
  let r = t.intlSegmenter;
3160
3202
  if (r.resolvedOptions().granularity != "word") throw Error("The segmenter passed must have a granularity of \"word\"");
3161
- n = ur(e, r);
3162
- } else n = e.match(hr) || [];
3203
+ n = pr(e, r);
3204
+ } else n = e.match(vr) || [];
3163
3205
  let r = [], i = null;
3164
3206
  return n.forEach((e) => {
3165
3207
  /\s/.test(e) ? i == null ? r.push(e) : r.push(r.pop() + e) : i != null && /\s/.test(i) ? r[r.length - 1] == i ? r.push(r.pop() + e) : r.push(i + e) : r.push(e), i = e;
@@ -3172,57 +3214,57 @@ new class extends $ {
3172
3214
  if (!e || t.oneChangePerToken) return e;
3173
3215
  let n = null, r = null, i = null;
3174
3216
  return e.forEach((e) => {
3175
- e.added ? r = e : e.removed ? i = e : ((r || i) && gr(n, i, r, e, t.intlSegmenter), n = e, r = null, i = null);
3176
- }), (r || i) && gr(n, i, r, null, t.intlSegmenter), e;
3217
+ e.added ? r = e : e.removed ? i = e : ((r || i) && yr(n, i, r, e, t.intlSegmenter), n = e, r = null, i = null);
3218
+ }), (r || i) && yr(n, i, r, null, t.intlSegmenter), e;
3177
3219
  }
3178
3220
  }();
3179
- function gr(e, t, n, r, i) {
3221
+ function yr(e, t, n, r, i) {
3180
3222
  if (t && n) {
3181
- let [a, o] = pr(t.value, i), [s, c] = pr(n.value, i);
3223
+ let [a, o] = gr(t.value, i), [s, c] = gr(n.value, i);
3182
3224
  if (e) {
3183
- let r = nr(a, s);
3184
- e.value = ar(e.value, s, r), t.value = or(t.value, r), n.value = or(n.value, r);
3225
+ let r = ar(a, s);
3226
+ e.value = cr(e.value, s, r), t.value = lr(t.value, r), n.value = lr(n.value, r);
3185
3227
  }
3186
3228
  if (r) {
3187
- let e = rr(o, c);
3188
- r.value = ir(r.value, c, e), t.value = sr(t.value, e), n.value = sr(n.value, e);
3229
+ let e = or(o, c);
3230
+ r.value = sr(r.value, c, e), t.value = ur(t.value, e), n.value = ur(n.value, e);
3189
3231
  }
3190
3232
  } else if (n) {
3191
3233
  if (e) {
3192
- let e = fr(n.value, i);
3234
+ let e = hr(n.value, i);
3193
3235
  n.value = n.value.substring(e.length);
3194
3236
  }
3195
3237
  if (r) {
3196
- let e = fr(r.value, i);
3238
+ let e = hr(r.value, i);
3197
3239
  r.value = r.value.substring(e.length);
3198
3240
  }
3199
3241
  } else if (e && r) {
3200
- let n = fr(r.value, i), [a, o] = pr(t.value, i), s = nr(n, a);
3201
- t.value = or(t.value, s);
3202
- let c = rr(or(n, s), o);
3203
- t.value = sr(t.value, c), r.value = ir(r.value, n, c), e.value = ar(e.value, n, n.slice(0, n.length - c.length));
3242
+ let n = hr(r.value, i), [a, o] = gr(t.value, i), s = ar(n, a);
3243
+ t.value = lr(t.value, s);
3244
+ let c = or(lr(n, s), o);
3245
+ t.value = ur(t.value, c), r.value = sr(r.value, n, c), e.value = cr(e.value, n, n.slice(0, n.length - c.length));
3204
3246
  } else if (r) {
3205
- let e = fr(r.value, i), n = cr(dr(t.value, i), e);
3206
- t.value = sr(t.value, n);
3247
+ let e = hr(r.value, i), n = dr(mr(t.value, i), e);
3248
+ t.value = ur(t.value, n);
3207
3249
  } else if (e) {
3208
- let n = cr(dr(e.value, i), fr(t.value, i));
3209
- t.value = or(t.value, n);
3250
+ let n = dr(mr(e.value, i), hr(t.value, i));
3251
+ t.value = lr(t.value, n);
3210
3252
  }
3211
3253
  }
3212
- new class extends $ {
3254
+ new class extends nr {
3213
3255
  tokenize(e) {
3214
- let t = RegExp(`(\\r?\\n)|[${mr}]+|[^\\S\\n\\r]+|[^${mr}]`, "ug");
3256
+ let t = RegExp(`(\\r?\\n)|[${_r}]+|[^\\S\\n\\r]+|[^${_r}]`, "ug");
3215
3257
  return e.match(t) || [];
3216
3258
  }
3217
- }(), new class extends $ {
3259
+ }(), new class extends nr {
3218
3260
  constructor() {
3219
- super(...arguments), this.tokenize = _r;
3261
+ super(...arguments), this.tokenize = br;
3220
3262
  }
3221
3263
  equals(e, t, n) {
3222
3264
  return n.ignoreWhitespace ? ((!n.newlineIsToken || !e.includes("\n")) && (e = e.trim()), (!n.newlineIsToken || !t.includes("\n")) && (t = t.trim())) : n.ignoreNewlineAtEof && !n.newlineIsToken && (e.endsWith("\n") && (e = e.slice(0, -1)), t.endsWith("\n") && (t = t.slice(0, -1))), super.equals(e, t, n);
3223
3265
  }
3224
3266
  }();
3225
- function _r(e, t) {
3267
+ function br(e, t) {
3226
3268
  t.stripTrailingCr && (e = e.replace(/\r\n/g, "\n"));
3227
3269
  let n = [], r = e.split(/(\n|\r\n)/);
3228
3270
  r[r.length - 1] || r.pop();
@@ -3234,10 +3276,10 @@ function _r(e, t) {
3234
3276
  }
3235
3277
  //#endregion
3236
3278
  //#region node_modules/diff/libesm/diff/sentence.js
3237
- function vr(e) {
3279
+ function xr(e) {
3238
3280
  return e == "." || e == "!" || e == "?";
3239
3281
  }
3240
- new class extends $ {
3282
+ new class extends nr {
3241
3283
  tokenize(e) {
3242
3284
  let t = [], n = 0;
3243
3285
  for (let r = 0; r < e.length; r++) {
@@ -3245,39 +3287,39 @@ new class extends $ {
3245
3287
  t.push(e.slice(n));
3246
3288
  break;
3247
3289
  }
3248
- if (vr(e[r]) && e[r + 1].match(/\s/)) {
3290
+ if (xr(e[r]) && e[r + 1].match(/\s/)) {
3249
3291
  for (t.push(e.slice(n, r + 1)), r = n = r + 1; e[r + 1]?.match(/\s/);) r++;
3250
3292
  t.push(e.slice(n, r + 1)), n = r + 1;
3251
3293
  }
3252
3294
  }
3253
3295
  return t;
3254
3296
  }
3255
- }(), new class extends $ {
3297
+ }(), new class extends nr {
3256
3298
  tokenize(e) {
3257
3299
  return e.split(/([{}:;,]|\s+)/);
3258
3300
  }
3259
- }(), new class extends $ {
3301
+ }(), new class extends nr {
3260
3302
  constructor() {
3261
- super(...arguments), this.tokenize = _r;
3303
+ super(...arguments), this.tokenize = br;
3262
3304
  }
3263
3305
  get useLongestToken() {
3264
3306
  return !0;
3265
3307
  }
3266
3308
  castInput(e, t) {
3267
3309
  let { undefinedReplacement: n, stringifyReplacer: r = (e, t) => t === void 0 ? n : t } = t;
3268
- return typeof e == "string" ? e : JSON.stringify(yr(e, null, null, r), null, " ");
3310
+ return typeof e == "string" ? e : JSON.stringify(Sr(e, null, null, r), null, " ");
3269
3311
  }
3270
3312
  equals(e, t, n) {
3271
3313
  return super.equals(e.replace(/,([\r\n])/g, "$1"), t.replace(/,([\r\n])/g, "$1"), n);
3272
3314
  }
3273
3315
  }();
3274
- function yr(e, t, n, r, i) {
3316
+ function Sr(e, t, n, r, i) {
3275
3317
  t ||= [], n ||= [], r && (e = r(i === void 0 ? "" : i, e));
3276
3318
  let a = 0;
3277
3319
  for (; a < t.length; a += 1) if (t[a] === e) return n[a];
3278
3320
  let o;
3279
3321
  if (Object.prototype.toString.call(e) === "[object Array]") {
3280
- for (t.push(e), o = Array(e.length), n.push(o), a = 0; a < e.length; a += 1) o[a] = yr(e[a], t, n, r, String(a));
3322
+ for (t.push(e), o = Array(e.length), n.push(o), a = 0; a < e.length; a += 1) o[a] = Sr(e[a], t, n, r, String(a));
3281
3323
  return t.pop(), n.pop(), o;
3282
3324
  }
3283
3325
  if (e && e.toJSON && (e = e.toJSON()), typeof e == "object" && e) {
@@ -3286,12 +3328,12 @@ function yr(e, t, n, r, i) {
3286
3328
  for (s in e)
3287
3329
  /* istanbul ignore else */
3288
3330
  Object.prototype.hasOwnProperty.call(e, s) && i.push(s);
3289
- for (i.sort(), a = 0; a < i.length; a += 1) s = i[a], o[s] = yr(e[s], t, n, r, s);
3331
+ for (i.sort(), a = 0; a < i.length; a += 1) s = i[a], o[s] = Sr(e[s], t, n, r, s);
3290
3332
  t.pop(), n.pop();
3291
3333
  } else o = e;
3292
3334
  return o;
3293
3335
  }
3294
- new class extends $ {
3336
+ new class extends nr {
3295
3337
  tokenize(e) {
3296
3338
  return e.slice();
3297
3339
  }
@@ -3304,7 +3346,7 @@ new class extends $ {
3304
3346
  }();
3305
3347
  //#endregion
3306
3348
  //#region src/utils/UndoRedoManager.js
3307
- var br = class {
3349
+ var Cr = class {
3308
3350
  constructor(e) {
3309
3351
  this.editor = e, this.textarea = e.usertextarea, this.undoStack = [], this.redoStack = [], this.lastValue = this.textarea.value, this.lastSelection = {
3310
3352
  selectionStart: this.textarea.selectionStart,
@@ -3338,7 +3380,7 @@ var br = class {
3338
3380
  let e = this.textarea.value || "";
3339
3381
  if (e === this.lastValue) return;
3340
3382
  clearTimeout(this._debounceTimer);
3341
- let t = tr(this.lastValue, e);
3383
+ let t = ir(this.lastValue, e);
3342
3384
  this.undoStack.push({
3343
3385
  diff: t,
3344
3386
  selection: { ...this.lastSelection }
@@ -3378,7 +3420,7 @@ var br = class {
3378
3420
  _restoreState(e, t) {
3379
3421
  this.textarea.value = e, this.textarea.setSelectionRange(t.selectionStart, t.selectionEnd), this.lastValue = e, this.lastSelection = { ...t }, this.editor.render && this.editor.render(), this.editor.notifyChange(), this.textarea.focus();
3380
3422
  }
3381
- }, xr = class {
3423
+ }, wr = class {
3382
3424
  constructor(e, t) {
3383
3425
  this.editor = e, this.textarea = e.usertextarea, this.renderCallback = t, this.pairs = {
3384
3426
  "{": "}",
@@ -3471,7 +3513,7 @@ var br = class {
3471
3513
  _applyChange(e, t, n) {
3472
3514
  this.textarea.value = e, this.textarea.setSelectionRange(t, n);
3473
3515
  }
3474
- }, Sr = class {
3516
+ }, Tr = class {
3475
3517
  constructor(e) {
3476
3518
  this.editor = e, this.textarea = e.usertextarea, this._keydownHandler = (e) => {
3477
3519
  e.key === "Enter" && this.handleEnter(e);
@@ -3497,12 +3539,12 @@ var br = class {
3497
3539
  this.textarea.setSelectionRange(o, o), this.editor.render(), this.editor.notifyChange();
3498
3540
  }
3499
3541
  }
3500
- }, Cr = [
3542
+ }, Er = [
3501
3543
  {
3502
3544
  key: "b",
3503
3545
  ctrl: !0,
3504
3546
  shift: !1,
3505
- ToolClass: Tn,
3547
+ ToolClass: kn,
3506
3548
  label: "Ctrl+B",
3507
3549
  btnClass: "bold-btn"
3508
3550
  },
@@ -3510,7 +3552,7 @@ var br = class {
3510
3552
  key: "i",
3511
3553
  ctrl: !0,
3512
3554
  shift: !1,
3513
- ToolClass: En,
3555
+ ToolClass: An,
3514
3556
  label: "Ctrl+I",
3515
3557
  btnClass: "italic-btn"
3516
3558
  },
@@ -3518,7 +3560,7 @@ var br = class {
3518
3560
  key: "k",
3519
3561
  ctrl: !0,
3520
3562
  shift: !1,
3521
- ToolClass: Pn,
3563
+ ToolClass: $,
3522
3564
  label: "Ctrl+K",
3523
3565
  btnClass: "link-btn"
3524
3566
  },
@@ -3526,7 +3568,7 @@ var br = class {
3526
3568
  key: "`",
3527
3569
  ctrl: !0,
3528
3570
  shift: !1,
3529
- ToolClass: Hn,
3571
+ ToolClass: Wn,
3530
3572
  label: "Ctrl+`",
3531
3573
  btnClass: "code-btn"
3532
3574
  },
@@ -3534,7 +3576,7 @@ var br = class {
3534
3576
  key: "s",
3535
3577
  ctrl: !0,
3536
3578
  shift: !0,
3537
- ToolClass: Dn,
3579
+ ToolClass: jn,
3538
3580
  label: "Ctrl+Shift+S",
3539
3581
  btnClass: "strikethrough-btn"
3540
3582
  },
@@ -3542,12 +3584,12 @@ var br = class {
3542
3584
  key: "l",
3543
3585
  ctrl: !0,
3544
3586
  shift: !1,
3545
- ToolClass: On,
3587
+ ToolClass: Mn,
3546
3588
  label: "Ctrl+L",
3547
3589
  btnClass: "ul-btn"
3548
3590
  }
3549
3591
  ];
3550
- function wr(e) {
3592
+ function Dr(e) {
3551
3593
  let t = String(e).split("+").map((e) => e.trim().toLowerCase()), n = t.pop();
3552
3594
  return n ? {
3553
3595
  key: n,
@@ -3556,11 +3598,11 @@ function wr(e) {
3556
3598
  alt: t.includes("alt")
3557
3599
  } : null;
3558
3600
  }
3559
- var Tr = class {
3601
+ var Or = class {
3560
3602
  constructor(e) {
3561
3603
  this.editor = e, this.toolShortcuts = (e.toolbarInstance?.tools ?? []).filter((e) => e.shortcut).map((e) => ({
3562
3604
  tool: e,
3563
- combo: wr(e.shortcut)
3605
+ combo: Dr(e.shortcut)
3564
3606
  })).filter((e) => e.combo), this._handler = this._onKeyDown.bind(this), this._docHandler = this._onDocKeyDown.bind(this), e.usertextarea.addEventListener("keydown", this._handler), document.addEventListener("keydown", this._docHandler), this._updateTooltips();
3565
3607
  }
3566
3608
  _onKeyDown(e) {
@@ -3574,14 +3616,14 @@ var Tr = class {
3574
3616
  "2",
3575
3617
  "3"
3576
3618
  ].includes(e.key)) {
3577
- e.preventDefault(), new Fn(this.editor).applyHeading(parseInt(e.key));
3619
+ e.preventDefault(), new Ln(this.editor).applyHeading(parseInt(e.key));
3578
3620
  return;
3579
3621
  }
3580
3622
  for (let { tool: i, combo: a } of this.toolShortcuts) if (r === a.key && t === a.ctrl && n === a.shift && e.altKey === a.alt) {
3581
3623
  e.preventDefault(), i.applySyntax(e);
3582
3624
  return;
3583
3625
  }
3584
- for (let i of Cr) if (r === i.key && t === i.ctrl && n === i.shift) {
3626
+ for (let i of Er) if (r === i.key && t === i.ctrl && n === i.shift) {
3585
3627
  e.preventDefault(), new i.ToolClass(this.editor).applySyntax(e);
3586
3628
  return;
3587
3629
  }
@@ -3593,7 +3635,7 @@ var Tr = class {
3593
3635
  }
3594
3636
  }
3595
3637
  _updateTooltips() {
3596
- for (let { btnClass: e, label: t } of Cr) {
3638
+ for (let { btnClass: e, label: t } of Er) {
3597
3639
  let n = this.editor.editorContainer.querySelector(`.${e}`);
3598
3640
  n && (n.title += ` (${t})`);
3599
3641
  }
@@ -3606,7 +3648,7 @@ var Tr = class {
3606
3648
  destroy() {
3607
3649
  this.editor.usertextarea.removeEventListener("keydown", this._handler), document.removeEventListener("keydown", this._docHandler);
3608
3650
  }
3609
- }, Er = class {
3651
+ }, kr = class {
3610
3652
  constructor(e) {
3611
3653
  this.editor = e, this._matches = [], this._currentIndex = -1, this._caseSensitive = !1, this._panel = null, this._findInput = null, this._replaceInput = null, this._countEl = null, this._replaceRow = null, this._caseSensitiveBtn = null, this._highlightEl = null, this._scrollHandler = null, this._taHandler = this._onTextareaKeyDown.bind(this), e.usertextarea.addEventListener("keydown", this._taHandler);
3612
3654
  }
@@ -3758,7 +3800,7 @@ var Tr = class {
3758
3800
  destroy() {
3759
3801
  this.editor.usertextarea.removeEventListener("keydown", this._taHandler), this._scrollHandler && this.editor.usertextarea.removeEventListener("scroll", this._scrollHandler), this._clearMatchHighlight(), this._panel?.remove();
3760
3802
  }
3761
- }, Dr = /^https?:\/\/\S+$/i, Or = class {
3803
+ }, Ar = /^https?:\/\/\S+$/i, jr = class {
3762
3804
  constructor(e) {
3763
3805
  this.editor = e, this.textarea = e.usertextarea, this._pasteHandler = (e) => this._onPaste(e), this._dropHandler = (e) => this._onDrop(e), this._dragOverHandler = (e) => {
3764
3806
  this._carriesFiles(e.dataTransfer) && e.preventDefault();
@@ -3784,7 +3826,7 @@ var Tr = class {
3784
3826
  return;
3785
3827
  }
3786
3828
  let n = e.clipboardData?.getData("text/plain")?.trim(), { selectionStart: r, selectionEnd: i } = this.textarea;
3787
- if (n && i > r && Dr.test(n)) {
3829
+ if (n && i > r && Ar.test(n)) {
3788
3830
  e.preventDefault();
3789
3831
  let t = `[${this.textarea.value.slice(r, i)}](${n})`;
3790
3832
  this.editor.insertText(t, t.length, 0);
@@ -3807,7 +3849,7 @@ var Tr = class {
3807
3849
  let e = `![${this.editor.label("Uploading...")}]()`;
3808
3850
  this.editor.insertText(e, e.length, 0);
3809
3851
  try {
3810
- let { path: n, alt: r } = await In(t, this.editor.imageUpload);
3852
+ let { path: n, alt: r } = await Rn(t, this.editor.imageUpload);
3811
3853
  this._replace(e, `![${r}](${n})`);
3812
3854
  } catch (t) {
3813
3855
  this._replace(e, `![${this.editor.label("Upload failed")}]()`), console.error("[MarkdownEditor] Image upload failed.", t);
@@ -3821,9 +3863,9 @@ var Tr = class {
3821
3863
  let i = r + t.length;
3822
3864
  n.setSelectionRange(i, i), this.editor.render(), this.editor.notifyChange();
3823
3865
  }
3824
- }, kr = new ot({ breaks: !0 }), Ar = class {
3866
+ }, Mr = new ot({ breaks: !0 }), Nr = class {
3825
3867
  constructor(e, t = {}) {
3826
- this.usertextarea = typeof e == "string" ? document.querySelector(e) : e, this.options = t, this.mode = t.mode || "plain", this.preview = !this.options.toolbar || this.options.toolbar.includes("preview"), this.footerOptions = this._parseFooterOptions(t.footer), this.variables = this._parseVariables(t.toolbar), this.imageUpload = this._parseImageUpload(t.toolbar), this.previewTimer = null, this.init(), this.undoRedoManager = new br(this), this.listManager = new Sr(this), this.indentManager = new xr(this), this.shortcutManager = new Tr(this), this.findReplace = new Er(this), this.pasteManager = new Or(this);
3868
+ this.usertextarea = typeof e == "string" ? document.querySelector(e) : e, this.options = t, this.mode = t.mode || "plain", this.preview = !this.options.toolbar || this.options.toolbar.includes("preview"), this.footerOptions = this._parseFooterOptions(t.footer), this.variables = this._parseVariables(t.toolbar), this.imageUpload = this._parseImageUpload(t.toolbar), this.previewTimer = null, this.init(), this.undoRedoManager = new Cr(this), this.listManager = new Tr(this), this.indentManager = new wr(this), this.shortcutManager = new Or(this), this.findReplace = new kr(this), this.pasteManager = new jr(this);
3827
3869
  }
3828
3870
  label(e) {
3829
3871
  return this.options.labels?.[e] ?? e;
@@ -3856,7 +3898,7 @@ var Tr = class {
3856
3898
  return this.usertextarea.tagName === "TEXTAREA";
3857
3899
  }
3858
3900
  applyDefaultAttributes() {
3859
- this.usertextarea.id && document.querySelector(`label[for="${this.usertextarea.id}"]`) || this.usertextarea.getAttribute("aria-label") || this.usertextarea.getAttribute("aria-labelledby") || (this.usertextarea.setAttribute("aria-label", this.options.label || "Markdown editor"), this._addedAriaLabel = !0), this.usertextarea.classList.add("editor-textarea", "fj:focus:ring-0", "fj:focus:outline-0", "fj:border-0", "fj:border-base-soft", "fj:px-4", "fj:py-2", "fj:max-w-full", "fj:w-full", "fj:h-full", "fj:bg-transparent", "fj:outline-0", "fj:appearance-none", "fj:overflow-y-auto"), this.usertextarea.hasAttribute("placeholder") || (this.usertextarea.placeholder = this.options.placeholder || "Write your markdown...");
3901
+ this.usertextarea.id && document.querySelector(`label[for="${this.usertextarea.id}"]`) || this.usertextarea.getAttribute("aria-label") || this.usertextarea.getAttribute("aria-labelledby") || (this.usertextarea.setAttribute("aria-label", this.options.label || "Markdown editor"), this._addedAriaLabel = !0), this.usertextarea.classList.add("editor-textarea", "fj:focus:ring-0", "fj:focus:outline-0", "fj:border-0", "fj:border-base-soft", "fj:px-4", "fj:py-2", "fj:max-w-full", "fj:w-full", "fj:h-full", "fj:bg-transparent", "fj:outline-0", "fj:appearance-none", "fj:overflow-y-auto", "fj:resize-none"), this.usertextarea.hasAttribute("placeholder") || (this.usertextarea.placeholder = this.options.placeholder || "Write your markdown...");
3860
3902
  }
3861
3903
  buildEditorLayout() {
3862
3904
  this.editorContainer = document.createElement("div"), this.editorContainer.className = "\n markdown-editor-wrapper\n fj:me-surface\n fj:me-surface-outline\n fj:me-surface-rounded\n fj:overflow-hidden\n fj:flex\n fj:flex-col\n ";
@@ -3865,10 +3907,10 @@ var Tr = class {
3865
3907
  }
3866
3908
  addTextareaWrapper() {
3867
3909
  let e = document.createElement("div");
3868
- e.className = "\n textarea-wrapper\n not-prose\n fj:me-surface\n fj:h-full\n fj:min-h-0\n fj:relative\n fj:grid\n ", this.mode == "hybrid" && (this.displayLayer = document.createElement("div"), this.displayLayer.setAttribute("data-placeholder", this.usertextarea.placeholder), this.displayLayer.setAttribute("aria-hidden", !0), this.displayLayer.className = "\n display-layer\n fj:px-4\n fj:py-2\n fj:whitespace-pre-wrap fj:wrap-break-word\n fj:pointer-events-none\n fj:absolute\n fj:inset-0\n fj:m-0\n fj:box-border\n fj:z-0\n fj:overflow-y-auto\n fj:empty:after:content-[attr(data-placeholder)]\n fj:empty:after:absolute\n fj:empty:after:inset-0\n fj:empty:after:px-4\n fj:empty:after:py-2\n fj:empty:after:text-[CanvasText]\n fj:empty:after:opacity-50\n ", this.usertextarea.className += "\n fj:text-transparent\n fj:caret-primary\n fj:resize-none\n fj:outline-none\n fj:m-0\n fj:box-border\n fj:relative\n fj:z-10\n ", e.appendChild(this.displayLayer)), e.appendChild(this.usertextarea), this.markdownEditorDiv.appendChild(e);
3910
+ e.className = "\n textarea-wrapper\n not-prose\n fj:me-surface\n fj:h-full\n fj:min-h-0\n fj:relative\n fj:grid\n ", this.mode == "hybrid" && (this.displayLayer = document.createElement("div"), this.displayLayer.setAttribute("data-placeholder", this.usertextarea.placeholder), this.displayLayer.setAttribute("aria-hidden", !0), this.displayLayer.className = "\n display-layer\n fj:px-4\n fj:py-2\n fj:whitespace-pre-wrap fj:wrap-break-word\n fj:pointer-events-none\n fj:absolute\n fj:inset-0\n fj:m-0\n fj:box-border\n fj:z-0\n fj:overflow-y-auto\n fj:empty:after:content-[attr(data-placeholder)]\n fj:empty:after:absolute\n fj:empty:after:inset-0\n fj:empty:after:px-4\n fj:empty:after:py-2\n fj:empty:after:text-[CanvasText]\n fj:empty:after:opacity-50\n ", this.usertextarea.className += "\n fj:text-transparent\n fj:caret-primary\n fj:outline-none\n fj:m-0\n fj:box-border\n fj:relative\n fj:z-10\n ", e.appendChild(this.displayLayer)), e.appendChild(this.usertextarea), this.markdownEditorDiv.appendChild(e);
3869
3911
  }
3870
3912
  addPreviewWrapper() {
3871
- let e = new Qn(this.markdownEditorDiv);
3913
+ let e = new er(this.markdownEditorDiv);
3872
3914
  this.previewContent = e.getPreviewContent();
3873
3915
  }
3874
3916
  addInputListener() {
@@ -3899,13 +3941,13 @@ var Tr = class {
3899
3941
  "strikethrough"
3900
3942
  ]) {
3901
3943
  let n = Object.create(this);
3902
- return n.usertextarea = e, n.scrollToView = () => {}, n.render = () => {}, n.notifyChange = () => {}, n.insertText = (t, n = 0, r = 0) => {
3903
- let { selectionStart: i, selectionEnd: a, value: o } = e;
3904
- e.value = o.slice(0, i) + t + o.slice(a), e.focus(), e.setSelectionRange(i + n, i + t.length - r);
3905
- }, new Zn(n, t, { standalone: !0 }).toolbar;
3944
+ return n.usertextarea = e, n.render = () => {}, n.notifyChange = () => {}, n.insertText = (t, n = 0, r = 0) => {
3945
+ let { selectionStart: i, selectionEnd: a, value: o } = e, s = e.scrollTop;
3946
+ e.value = o.slice(0, i) + t + o.slice(a), e.focus(), e.setSelectionRange(i + n, i + t.length - r), e.scrollTop = s;
3947
+ }, new $n(n, t, { standalone: !0 }).toolbar;
3906
3948
  }
3907
3949
  _renderMarkdown(e) {
3908
- let t = this.options.renderer ?? ((e) => kr.parse(e)), n = this.options.sanitizer ?? ((e) => wn.sanitize(e)), r = qn(e, this.variables), i = t(r);
3950
+ let t = this.options.renderer ?? ((e) => Mr.parse(e)), n = this.options.sanitizer ?? ((e) => On.sanitize(e)), r = Yn(e, this.variables), i = t(r);
3909
3951
  return this.options.renderer && !this._taskListWarned && /^\s*[-*] \[[ xX]\] /m.test(r) && !/type=["']?checkbox/.test(i) && (this._taskListWarned = !0, console.warn("[MarkdownEditor] Task list syntax found, but the custom renderer emitted no checkboxes. Clickable checkboxes in the preview need a task-list plugin, e.g. markdown-it-task-lists.")), n(i);
3910
3952
  }
3911
3953
  wirePreviewCheckboxes() {
@@ -3927,10 +3969,10 @@ var Tr = class {
3927
3969
  addFooter() {
3928
3970
  if (!this.footerOptions) return;
3929
3971
  let { line: e, col: t, chars: n, words: r } = this.footerOptions;
3930
- (e || t || n || r) && (this.footer = new $n(this.editorContainer, this.footerOptions), this.footer.update(this.usertextarea), this._footerUpdate = () => this.footer.update(this.usertextarea), this.usertextarea.addEventListener("input", this._footerUpdate), this.usertextarea.addEventListener("click", this._footerUpdate), this.usertextarea.addEventListener("keyup", this._footerUpdate), this.usertextarea.addEventListener("focus", this._footerUpdate));
3972
+ (e || t || n || r) && (this.footer = new tr(this.editorContainer, this.footerOptions), this.footer.update(this.usertextarea), this._footerUpdate = () => this.footer.update(this.usertextarea), this.usertextarea.addEventListener("input", this._footerUpdate), this.usertextarea.addEventListener("click", this._footerUpdate), this.usertextarea.addEventListener("keyup", this._footerUpdate), this.usertextarea.addEventListener("focus", this._footerUpdate));
3931
3973
  }
3932
3974
  addToolbar() {
3933
- this.toolbarInstance = new Zn(this, this.options.toolbar || [
3975
+ this.toolbarInstance = new $n(this, this.options.toolbar || [
3934
3976
  "undo",
3935
3977
  "redo",
3936
3978
  "heading",
@@ -3953,13 +3995,13 @@ var Tr = class {
3953
3995
  ]);
3954
3996
  }
3955
3997
  insertText(e, t = 0, n = 0) {
3956
- let { selectionStart: r, selectionEnd: i } = this.usertextarea, a = this.usertextarea.value;
3957
- this.usertextarea.value = `${a.substring(0, r)}${e}${a.substring(i)}`, this.usertextarea.focus(), this.usertextarea.setSelectionRange(r + t, r + e.length - n), this.scrollToView(), this.render(), this.notifyChange();
3998
+ let { selectionStart: r, selectionEnd: i } = this.usertextarea, a = this.usertextarea.value, o = this.usertextarea.scrollTop;
3999
+ this.usertextarea.value = `${a.substring(0, r)}${e}${a.substring(i)}`, this.usertextarea.focus(), this.usertextarea.setSelectionRange(r + t, r + e.length - n), this.render(), this.notifyChange(), this.restoreScroll(o);
3958
4000
  }
3959
- scrollToView() {
3960
- let e = this.usertextarea, t = e.selectionStart, n = parseInt(window.getComputedStyle(e).lineHeight), r = e.value.substring(0, t).split("\n").length - 1, i = Math.floor(e.clientHeight / n);
3961
- e.scrollTop = (r - Math.floor(i / 2)) * n;
4001
+ restoreScroll(e) {
4002
+ this.usertextarea.scrollTop = e;
3962
4003
  }
4004
+ scrollToView() {}
3963
4005
  _highlight(e) {
3964
4006
  let t = e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
3965
4007
  return t = t.replace(/```(\w+)?\n([\s\S]*?)```/g, "<span class=\"fj:opacity-30\">```$1</span>\n$2<span class=\"fj:opacity-30\">```</span>").replace(/`([^`\n]+)`/g, "<span class=\"fj:opacity-40\">`</span><span class=\"fj:text-accent\">$1</span><span class=\"fj:opacity-40\">`</span>").replace(/^(#+ )(.*)$/gm, "<span class=\"fj:text-primary\"><span class=\"fj:opacity-40\">$1</span><span class=\"faux-bold\">$2</span></span>").replace(/\*\*(.*?)\*\*/g, "<span class=\"fj:text-secondary\"><span class=\"fj:opacity-40\">**</span><span class=\"faux-bold\">$1</span><span class=\"fj:opacity-40\">**</span></span>").replace(/^([\s]*)([\-\*] |[\d]+\. |\[[\s xX]\] )(.*)$/gm, "$1<span class=\"fj:text-primary\">$2</span>$3").replace(/(\*|_)(.*?)\1/g, "<span class=\"fj:text-accent\"><span class=\"fj:opacity-40\">$1</span>$2<span class=\"fj:opacity-40\">$1</span></span>").replace(/~~(.*?)~~/g, "<span class=\"fj:line-through fj:opacity-70\"><span class=\"fj:opacity-40\">~~</span>$1<span class=\"fj:opacity-40\">~~</span></span>").replace(/(?<!~)(~)([^~]+)\1(?!~)/g, "<span class=\"fj:line-through fj:opacity-70\"><span class=\"fj:opacity-40\">$1</span>$2<span class=\"fj:opacity-40\">$1</span></span>").replace(/(!?\[)(.*?)(\]\()(.*?)(\))/g, "<span class=\"fj:opacity-40\">$1</span><span class=\"fj:text-primary\">$2</span><span class=\"fj:opacity-40\">$3</span><span class=\"fj:underline fj:opacity-50\">$4</span><span class=\"fj:opacity-50\">$5</span>"), e.endsWith("\n") && (t += " "), t;
@@ -3980,13 +4022,13 @@ var Tr = class {
3980
4022
  for (let e = 0; e < t.length; e++) t[e] !== n[e] && (this._lineNodes[e].innerHTML = t[e] + (e < t.length - 1 ? "\n" : ""), n[e] = t[e]);
3981
4023
  }
3982
4024
  _autoGrow() {
3983
- if (this.editorContainer.classList.contains("is-fullscreen")) return;
4025
+ if (this.editorContainer.classList.contains("is-fullscreen") || (this._autoHeight !== void 0 && this.editorContainer.style.height !== this._autoHeight && (this._userResized = !0), this._userResized)) return;
3984
4026
  let e = this.usertextarea;
3985
4027
  e.style.height = "1px";
3986
4028
  let t = e.scrollHeight;
3987
4029
  e.style.height = "";
3988
- let n = this.options.maxHeight ?? 500;
3989
- this.editorContainer.style.height = Math.min(t, n) + this._toolbarH + this._footerH + 1 + "px";
4030
+ let n = this.options.maxHeight ?? 500, r = Math.min(t, n) + this._toolbarH + this._footerH + 1;
4031
+ Number.isFinite(r) && (this._autoHeight = r + "px", this.editorContainer.style.height = this._autoHeight);
3990
4032
  }
3991
4033
  notifyChange() {
3992
4034
  this.options.onChange && this.options.onChange(this.usertextarea.value);
@@ -4023,8 +4065,8 @@ var Tr = class {
4023
4065
  ].forEach((e) => this.usertextarea.classList.remove(e)), this._addedAriaLabel && this.usertextarea.removeAttribute("aria-label"), this.usertextarea.style.height = "", e.insertBefore(this.usertextarea, this.editorContainer), this.editorContainer.remove());
4024
4066
  }
4025
4067
  };
4026
- Ar.Tool = Q, Ar.modal = Nn;
4068
+ Nr.Tool = Z, Nr.modal = In;
4027
4069
  //#endregion
4028
- export { Ar as default };
4070
+ export { Nr as default };
4029
4071
 
4030
4072
  //# sourceMappingURL=markdown-text-editor.es.js.map